CppCMS
http_context.h
1 //
3 // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_HTTP_CONTEXT_H
9 #define CPPCMS_HTTP_CONTEXT_H
10 
11 #include <cppcms/defs.h>
12 #include <booster/hold_ptr.h>
13 #include <booster/intrusive_ptr.h>
14 #include <booster/shared_ptr.h>
15 #include <booster/enable_shared_from_this.h>
16 #include <booster/callback.h>
17 #include <booster/noncopyable.h>
18 #include <locale>
19 
20 namespace cppcms {
21 
22  class service;
23  class application;
24  class cache_interface;
25  class session_interface;
26  namespace json { class value; }
27  namespace impl { namespace cgi { class connection; } }
28 
32  namespace http {
33  class request;
34  class response;
35 
44 
45  class CPPCMS_API context :
46  public booster::noncopyable,
47  public booster::enable_shared_from_this<context>
48  {
49  public:
51 
53  ~context();
54  impl::cgi::connection &connection();
55  void run();
56 
58 
63 
68 
72  json::value const &settings();
73 
77  cache_interface &cache();
78 
87  session_interface &session();
88 
92  std::locale locale();
93 
98  void locale(std::locale const &new_locale);
99 
105  void locale(std::string const &name);
106 
111 
115  std::string skin();
116 
120  void skin(std::string const &name);
121 
122 
123  typedef enum {
125  operation_aborted
126  } completion_type;
127 
129 
135  void complete_response();
136 
142  void async_complete_response();
143 
151 
152  void async_flush_output(handler const &h);
153 
165  void async_on_peer_reset(booster::callback<void()> const &h);
166  private:
167  void on_request_ready(bool error);
168  static void dispatch(booster::intrusive_ptr<application> app,std::string url,bool syncronous);
169  void try_restart(bool e);
171 
172  struct _data;
175  };
176 
177  }
178 
179 };
180 
181 #endif
This class is central representation of json objects.
Definition: json.h:142
This class represent the central event loop of the CppCMS applications.
Definition: service.h:59
Definition: callback.h:18
This class provides an access to an application for session management.
Definition: session_interface.h:69
context is a central class that holds all specific connection related information. It encapsulates CGI request and response, cache, session and locale information
Definition: http_context.h:45
intrusive_ptr is the class taken as-is from boost.
Definition: intrusive_ptr.h:42
Asynchronous operation completed successfully.
Definition: http_context.h:124
this class represents all HTTP/CGI response related API, generation of output content and HTTP header...
Definition: http_response.h:31
This class is the major gateway of the application to CppCMS caching abilities. Any access too cache ...
Definition: cache_interface.h:137
This class is borrowed from boost.
Definition: enable_shared_from_this.h:30
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
This class represents all information related to the HTTP/CGI request.
Definition: http_request.h:34