Generic web application interface class. More...
#include <web_application.h>

Public Types | |
|
typedef delegate2< const std::exception &, http_response &, void > | on_exception_handler |
| Exception handler. | |
|
typedef delegate1< const http_request &, http_response > | on_request_handler |
| Web request handler. | |
Public Member Functions | |
| virtual void | on_handle_request (on_request_handler handler)=0 |
| Register a custom web request handler. | |
| virtual void | on_exception (on_exception_handler handler)=0 |
| Register a custom exception handler. | |
Protected Member Functions | |
| virtual http_request | get_request ()=0 |
| virtual void | send_response (const http_response &)=0 |
Generic web application interface class.
This class is a parent for concrete web application classes: cgi_application, apache_application and isapi_application.
Basically you shouldn't use this interface class directly - use the concrete web application classes.
| virtual void dbp::web_application_int::on_exception | ( | on_exception_handler | handler | ) | [pure virtual] |
Register a custom exception handler.
By default, the web application returns the '500 Internal Server Error' HTTP error code on exceptions occured, but you can customize the default exceptions handling by registering your handler.
| handler | the exception handler delegate. |
Implemented in dbp::apache_application, dbp::cgi_application, and dbp::isapi_application.
| virtual void dbp::web_application_int::on_handle_request | ( | on_request_handler | handler | ) | [pure virtual] |
Register a custom web request handler.
To make your application doing something useful, you should register your web request handler.
This handler is a web application entry point. When client is passing the request, it comes to a web server, processed with it and delivers to the application. You can obtain web request fields via http_request parameter.
After processing of the request you should to deliver the appropriate response to a client via web server by returning initialized http_response object.
The 'examples/hello_world/cgi_application' directory contains the source code of the web request handler implementation example.
| handler | the request handler delegate. |
Implemented in dbp::apache_application, dbp::cgi_application, and dbp::isapi_application.