The factory can be used to instantiate the built-in HTTP classes. More...
#include <http.h>
Public Member Functions | |
virtual IServer * | create_server ()=0 |
Creates a new HTTP server. More... | |
virtual IRequest_handler * | create_file_handler (const char *root_url, const char *root_path, bool is_recursive=true)=0 |
Creates a new file handler for the server. More... | |
virtual IRequest_handler * | create_redirect_handler (const char *source_url, const char *target_url)=0 |
Creates a new redirect handler which will redirect requests to a certain URL to a new URL. More... | |
virtual IResponse_handler * | create_log_handler (const char *path)=0 |
Creates a new log handler. More... | |
virtual IResponse_handler * | create_chunked_encoding_handler ()=0 |
Creates a new chunked encoding handler. More... | |
virtual IWeb_socket * | create_client_web_socket (const char *web_socket_address, Float32 connect_timeout)=0 |
Creates a client-side WebSocket connection that will attempt to establish a connection to the specified server's address and will send WebSocket requests to the specified URL. More... | |
Public Member Functions inherited from mi::base::IInterface | |
virtual Uint32 | retain () const =0 |
Increments the reference count. More... | |
virtual Uint32 | release () const =0 |
Decrements the reference count. More... | |
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
Acquires a const interface from another. More... | |
template<class T> | |
const T * | get_interface () const |
Acquires a const interface from another. More... | |
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
Acquires a mutable interface from another. More... | |
template<class T> | |
T * | get_interface () |
Acquires a mutable interface from another. More... | |
virtual Uuid | get_iid () const =0 |
Returns the interface ID of the most derived interface. More... | |
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0xddded154, ... > | |
typedef Interface_declare< id1, ... > | Self |
Own type. More... | |
typedef Uuid_t< id1, ... > | IID |
Declares the interface ID (IID) of this interface. More... | |
Public Types inherited from mi::base::IInterface | |
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | IID |
Declares the interface ID (IID) of this interface. More... | |
Static Public Member Functions inherited from mi::base::Interface_declare< 0xddded154, ... > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... | |
Static Public Member Functions inherited from mi::base::IInterface | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface. More... | |
The factory can be used to instantiate the built-in HTTP classes.
In addition to the HTTP server it can create a number of built-in request and response handlers. Those handlers need to be installed with one or more servers using the server's install()
methods. Unless indicated otherwise a handler obtained from the factory function can be installed to multiple HTTP servers.
|
pure virtual |
Creates a new chunked encoding handler.
If installed on a server it will allow to keep connections alive even if the size of the generated content is not know in advance. This is done by installing a data handler on a connection if the response does not contain the data size when it is sent. The response handler will modify the response and then modify all data passed to the client to be sent in chunks. This handler needs to be installed as the last response handler to work correctly. Exempt from this are response handlers which do not change the data on the way to its clients, e.g., the log handler.
The handler needs to be installed with the desired server using mi::http::IServer::install(IResponse_handler*).
|
pure virtual |
Creates a client-side WebSocket connection that will attempt to establish a connection to the specified server's address and will send WebSocket requests to the specified URL.
web_socket_address | The address to be connected to. |
connect_timeout | The timeout interval in seconds when attempting to connect to a server. |
NULL
in case of failures."ws://host_address[:host_port]/url"
for insecure connections, or"wss://host_address[:host_port]/url"
for secure connections.
|
pure virtual |
Creates a new file handler for the server.
The handler will map a given file or directory into the URL namespace at the root_url
.
The handler needs to be installed with the desired server using mi::http::IServer::install(IRequest_handler*).
root_url | The URL needs to start with this prefix to be served by the handler. |
root_path | When a matching URL is found root_url is replaced by this argument to get the path of a file to be served. If this file can be opened for reading, it will be sent to the client. |
is_recursive | Indicates whether handler serves only a single file or a directory tree. |
|
pure virtual |
Creates a new log handler.
This handler will write a request log to a file with a given path. The file format of the log file is the so called 'Combined log format' used by various HTTP servers.
The handler needs to be installed with the desired server using mi::http::IServer::install(IResponse_handler*).
path | Path of the log file to be written. |
|
pure virtual |
Creates a new redirect handler which will redirect requests to a certain URL to a new URL.
The handler needs to be installed with the desired server using mi::http::IServer::install(IRequest_handler*).
source_url | If this URL is found it is redirected to the target_url . |
target_url | Target of the redirection. |
|
pure virtual |
Creates a new HTTP server.