NuriaProject Framework  0.1
The NuriaProject Framework
Public Member Functions | Protected Member Functions | Friends | List of all members
Nuria::HttpBackend Class Referenceabstract

Base class for HttpServer back-ends. More...

#include <httpbackend.hpp>

Inheritance diagram for Nuria::HttpBackend:
Nuria::FastCgiBackend

Public Member Functions

 HttpBackend (HttpServer *server)
 
 ~HttpBackend ()
 
HttpServerhttpServer () const
 
virtual bool isListening () const =0
 
virtual bool isSecure () const
 
virtual int port () const =0
 

Protected Member Functions

virtual void serverThreadCreated (QThread *thread)
 

Friends

class HttpServer
 

Detailed Description

Base class for HttpServer back-ends.

A HttpBackend is the bridge between a (probably low-level) connection medium, like a TCP listen socket, and the HttpServer this back-end is registered to.

For usage see HttpServer::addBackend() and HttpTransport::addToServer().

Constructor & Destructor Documentation

Nuria::HttpBackend::HttpBackend ( HttpServer server)

Constructor.

Nuria::HttpBackend::~HttpBackend ( )

Destructor.

Member Function Documentation

HttpServer* Nuria::HttpBackend::httpServer ( ) const

Returns the HTTP server this back-end is connected to.

virtual bool Nuria::HttpBackend::isListening ( ) const
pure virtual

Returns true if the server is currently listening for connections.

Implemented in Nuria::FastCgiBackend.

virtual bool Nuria::HttpBackend::isSecure ( ) const
virtual

Returns true if this back-end uses secure connections. The default implementation returns false.

Reimplemented in Nuria::FastCgiBackend.

virtual int Nuria::HttpBackend::port ( ) const
pure virtual

Returns the port this server is listening on, or -1 if it's not listening.

Implemented in Nuria::FastCgiBackend.

virtual void Nuria::HttpBackend::serverThreadCreated ( QThread *  thread)
protectedvirtual

Called by the HttpServer when a new server thread has been created. This lets back-ends register their own thread-specific bookkeeping routines.

This function will also be called by the HttpServer if no multi-threading is used. In this case, the function will be called once with thread being the one the server is associated with.

To run some kind of initialization after the thread has been started, use one of:

QTimer::singleShot (0, object, SLOT(...)); // Pre Qt5.4
QTimer::singleShot (0, object, &Object::...); // Qt5.4 and up
QTimer::singleShot (0, []() { ... }); // Qt5.4 and up
Note
The function is called in the thread the HttpServer lives in.

The default implementation does nothing.

Reimplemented in Nuria::FastCgiBackend.


The documentation for this class was generated from the following file: