CppCMS — C++ Web Framework
来源:互联网 发布:python黑帽子原码 编辑:程序博客网 时间:2024/06/05 02:47
程序中设置两个线程,一个负责程序本身运行(主线程),另一个负责主线程与其它进程的通信(主要是各种I/O操作)
cppcms::service::post()
将一个执行句柄放在事件循环队列,该函数是线程安全的
cppcms::http::response
this class represents all HTTP/CGI response related API, generation of output content and HTTP headers
cppcms::http::context Class Reference
context is a central class that holds all specific connection related information. It encapsulates CGI request and response, cache, session and locale information
CGI(Common Gateway Interface)
通用网关接口,可以让一个客户端,从网页浏览器向执行在网络服务器上的程序请求数据。CGI描述了服务器和请求处理程序之间传输数据的一种标准。
http::response& cppcms::http::context::response()
Get an interface to HTTP response
This function set HTTP Content-Type header, but unlike contet_type function it also adds current locale charset encoding (unless localization.disable_charset_in_content_type set to true in configuration)
void cppcms::http::response::content_length(unsigned long long len)
Set HTTP Header Content-Length
std::ostream& cppcms::http::response::out()
Request an output stream to write the body of HTTP response after writing headers.Note:
it triggers saving changes in the session, so further changes will have no effect.
it triggers writing all headers to output stream, such that changing any header or adding cookies will have no effect.
it is impossible to change an io_mode after calling this function.
std::basic_ostream<char, std::char_traits<char>> &std::basic_ostream<char, std::char_traits<char>>::write(const char* _Str, streamsize _Count)
etc: cout.write(...);
void cppcms::http::context::async_flush_output ( handler const & h )
Send all pending data to user, when operation is complete call handler h with status.
Note: if the status is operation_aborted, you can't use this connection any more, the peer gone.
void cppcms::http::context::async_complete_response()
Send all pending output data to the client and finalize the connection. Note, you can't use this object for communication any more.
json
This namespace includes all JSON parsing and formatting related classes and functions.
cppcms::json::value Class Reference
This class is central representation of json objects.
bool cppcms::json::value::load(std::istream& in,bool full,int *line_number = 0)
Read a value from std::istream.
returns true if the value was read successfully, otherwise returns false to indicate a syntax error.
template<typename T >
T cppcms::json::value::get(std::string const& path) const
inline Get an object of type T from the path path. Throws bad_value_cast if such path does not exists of conversion can't be done
cppcms::applications_pool& cppcms::service::applications_pool()
Get a cppcms::applications_pool instance of this service
cppcms::applications_pool Class Reference
Application pool is the central class that holds user created applications.
void cppcms::applications_pool::mount(booster::intrusive_ptr<application> app)
Mount an asynchronous application app for processing of any incoming requests. Application would receive PATH_INFO CGI variable for URL matching.
This member function is thread safe.
void cppcms::service::run()
Start the central even loop of CppCMS service. By default, it also install signal handlers on POSIX platforms to handle SIGINT, SIGTERM and SIGUSR1 signals or uses SetConsoleCtrlHandler on Windows platforms waiting on C, BREAK, CLOSE and SHUTDOWN events.
This even call service::shutdown function that stops the main event loop and shutdowns the service properly.
If you want to disable these handlers, you may set service.disable_global_exit_handling option to true.
void cppcms::application::attach(application* app,std::string const& regex,int part)
Register an application app as child and mount it into url_dispatcher calling dispatcher().mount(regex,*app,part);
Ownership of app is transfered to parent.
url_dispatcher& cppcms::application::dispatcher()
Get a dispatched class – class that responsible on mapping between URLs and a member functions of application class.
This member function is application specific and not Connection specific.
template<typename C>
void cppcms::url_dispatcher::assign(std::string const & regex,void(C::*)() member,C* object)
This template function is a shortcut to assign(regex,callback). It allows assignment of member function of an object with signature void handler() as simple as assign(expr,&bar::foo,this);
In addition to calling member function it calls object->init() before call and object->clean() after the call of the C is derived from cppcms::application
requests,responses,sessions, cache
- CppCMS — C++ Web Framework
- 用CppCMS实现web site并同时支持json_rpc服务
- Creating a simple web prototype based on CppCMS
- CppCMS 1.0.4 发布,高性能 C++ 的Web框架
- 使用Nginx+CppCMS构建高效Web应用服务器
- 使用Nginx+CppCMS构建高效Web应用服务器
- ubuntu 下编译cppcms cppcms-0.99.10.1
- 基于CPPCMS的web应用启动载入.js配置文件时遇到'Invalid or unsupported char set : utf-8"
- Web MVC framework Web框架
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- Java Web Framework综述
- web test framework
- ansible 条件判断+循环
- kafka0.8--0.11各个版本特性预览介绍
- 简单成绩判断
- 【微信】微信开发(3)不要掉进Cookie的坑!
- 15款Cocos2d-x游戏源码
- CppCMS — C++ Web Framework
- H264码流打包分析
- 设计模式的艺术之道--设计模式的基本概念
- 前端之js d3
- iOS NSString 转换编码格式ISO-8859-1
- Spring中使用单元测试--探索
- java位运算符 : 与(&)、非(~)、或(|)、异或(^)
- java Book
- Arrays.sort源码分析