Server Class Reference

#include <Pt/Http/Server.h>

An HTTP server.

Inherits Connectable, and NonCopyable.

Public Member Functions

 Server ()
 Default Constructor.
 
 Server (System::EventLoop &loop)
 Construct with event loop.
 
 Server (System::EventLoop &loop, const Net::Endpoint &ep)
 Construct with event loop and listen endpoint.
 
 ~Server ()
 Destructor.
 
void addServlet (Servlet &servlet)
 Adds a servlet.
 
void cancel ()
 Cancel all operations.
 
std::size_t keepAliveTimeout () const
 Returns the keepalive timeout in msecs.
 
void listen (const Net::Endpoint &ep)
 Start listening on endpoint.
 
void listen (const Net::Endpoint &ep, const Net::TcpServerOptions &opts)
 Start listening on endpoint.
 
System::EventLooploop ()
 Returns the used event loop.
 
std::size_t maxRequestSize () const
 Returns the maximum size of a request in bytes.
 
std::size_t maxThreads () const
 Returns the maximum number of server threads.
 
void removeServlet (Servlet &servlet)
 Removes a servlet.
 
void setActive (System::EventLoop &loop)
 Sets the event loop to use.
 
void setKeepAliveTimeout (std::size_t ms)
 Sets the keepalive timeout in msecs.
 
void setMaxRequestSize (std::size_t maxSize)
 Sets the maximum size of a request in bytes.
 
void setMaxThreads (std::size_t m)
 Sets the maximum number of server threads.
 
void setSecure (Ssl::Context &ctx)
 Enables to use HTTPS.
 
void setTimeout (std::size_t ms)
 Sets the timeout in msecs.
 
std::size_t timeout () const
 Returns the timeout in msecs.