![]() |
zeep::http::basic_server — The libzeep HTTP server implementation. Originally based on example code found in boost::asio.
// In header: <zeep/http/server.hpp> class basic_server { public: // construct/copy/destruct (); (); (security_context *); (security_context *, ); (basic_server &) = ; basic_server & (basic_server &) = ; ~(); // public member functions security_context & (); () ; (); () ; (); () ; (controller *); (error_handler *); (basic_template_processor *); basic_template_processor & (); basic_template_processor & () ; () ; (, ); (); (); (); () ; () ; () = ; (); // public static functions (); // protected member functions (, request &, reply &, , , , ) ; // private member functions (, request &, reply &); (); };
The server class is a simple, stand alone HTTP server. Call bind to make it listen to an address/port combination. Add controller classes to do the actual work. These controllers will be tried in the order at which they were added to see if they want to process a request.
basic_server
public
construct/copy/destruct();Simple server, no security, no template processor.
( docroot);Simple server, no security, create default template processor with docroot.
(security_context * s_ctxt);server with a security context for limited access
(security_context * s_ctxt, docroot);server with a security context for limited access, create default template processor with docroot
(basic_server &) = ;
basic_server & (basic_server &) = ;
~();
basic_server
public member functionssecurity_context & ();Get the security context provided in the constructor.
() ;Test if a security context was provided in the constructor.
( methods);Set the set of allowed methods (default is "GET", "POST", "PUT", "OPTIONS", "HEAD", "DELETE")
() ;Get the set of allowed methods.
( context_name);Set the context_name.
The context name is used in constructing relative URL's that start with a forward slash
() ;Get the context_name.
The context name is used in constructing relative URL's that start with a forward slash
(controller * c);Add controller to the list of controllers.
When a request is received, the list of controllers get a chance of handling it, in the order of which they were added to this server. If none of the controller handle the request the not_found error is returned.
(error_handler * eh);Add an error handler.
Errors are handled by the error handler list. The last added handler is called first.
(basic_template_processor * template_processor);Set the template processor.
A template processor handles loading templates and processing the contents.
basic_template_processor & ();Get the template processor.
A template processor handles loading templates and processing the contents. This will throw if the processor has not been set yet.
basic_template_processor & () ;Get the template processor.
A template processor handles loading templates and processing the contents. This will throw if the processor has not been set yet.
() ;returns whether template processor has been set
( address, port);Bind the server to address address and port port.
( nr_of_threads);Run as many as nr_of_threads threads simultaneously.
();Stop all threads and stop listening.
( v);log_forwarded tells the HTTP server to use the last entry in X-Forwarded-For as client log entry
() ;returns the address as specified in bind
() ;returns the port as specified in bind
() = ;get_io_context has to be public since we need it to call notify_fork from child code
();get_executor has to be public since we need it to call notify_fork from child code