http_context.h
//
// Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// See accompanying file COPYING.TXT file for licensing details.
//
#ifndef CPPCMS_HTTP_CONTEXT_H
#define CPPCMS_HTTP_CONTEXT_H
#include <cppcms/defs.h>
#include <booster/hold_ptr.h>
#include <booster/intrusive_ptr.h>
#include <booster/shared_ptr.h>
#include <booster/enable_shared_from_this.h>
#include <booster/callback.h>
#include <booster/noncopyable.h>
#include <locale>
namespace cppcms {
class service;
class application;
class cache_interface;
class session_interface;
namespace json { class value; }
namespace impl { namespace cgi { class connection; } }
namespace http {
class request;
class response;
class CPPCMS_API context :
public booster::noncopyable,
public booster::enable_shared_from_this<context>
{
public:
context(booster::shared_ptr<impl::cgi::connection> conn);
~context();
impl::cgi::connection &connection();
void run();
http::request &request();
http::response &response();
json::value const &settings();
cache_interface &cache();
session_interface &session();
std::locale locale();
void locale(std::locale const &new_locale);
void locale(std::string const &name);
cppcms::service &service();
std::string skin();
void skin(std::string const &name);
typedef enum {
operation_completed,
operation_aborted
} completion_type;
typedef booster::callback<void(completion_type)> handler;
void complete_response();
void async_complete_response();
void async_flush_output(handler const &h);
void async_on_peer_reset(booster::callback<void()> const &h);
private:
void on_request_ready(bool error);
static void dispatch(booster::intrusive_ptr<application> app,std::string url,bool syncronous);
void try_restart(bool e);
booster::shared_ptr<context> self();
struct _data;
booster::hold_ptr<_data> d;
booster::shared_ptr<impl::cgi::connection> conn_;
};
}
};
#endif
cppcms::json::value
This class is central representation of json objects.
Definition: json.h:142
booster::hold_ptr< _data >
cppcms::service
This class represent the central event loop of the CppCMS applications.
Definition: service.h:59
booster::callback
Definition: callback.h:18
cppcms::session_interface
This class provides an access to an application for session management.
Definition: session_interface.h:69
cppcms::http::context
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
booster::shared_ptr< impl::cgi::connection >
booster::intrusive_ptr
intrusive_ptr is the class taken as-is from boost.
Definition: intrusive_ptr.h:42
cppcms::http::context::operation_completed
Asynchronous operation completed successfully.
Definition: http_context.h:124
cppcms::http::response
this class represents all HTTP/CGI response related API, generation of output content and HTTP header...
Definition: http_response.h:31
cppcms::cache_interface
This class is the major gateway of the application to CppCMS caching abilities. Any access too cache ...
Definition: cache_interface.h:137
booster::enable_shared_from_this
This class is borrowed from boost.
Definition: enable_shared_from_this.h:30
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15
cppcms::http::request
This class represents all information related to the HTTP/CGI request.
Definition: http_request.h:34