Home · Modules · Classes · Namespaces · Functions

QxtAbstractHttpConnector Class Reference
[QxtWeb module]

The QxtAbstractHttpConnector class is a base class for defining HTTP-based protocols for use with QxtHttpSessionManager More...

    #include <QxtAbstractHttpConnector>

Inherits QObject.

Inherited by QxtHttpServerConnector and QxtScgiServerConnector.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QxtAbstractHttpConnector class is a base class for defining HTTP-based protocols for use with QxtHttpSessionManager

QxtHttpSessionManager does the work of managing sessions and state for the otherwise stateless HTTP protocol, but it relies on QxtAbstractHttpConnector subclasses to implement the protocol used to communicate with the web server.

Subclasses are responsible for accepting new connections (by implementing listen(const QHostAddress&, quint16) and invoking addConnection(QIODevice*)), for informing the session manager when request headers are available (by implementing canParseRequest(const QByteArray&)), for parsing the request headers (by implementing parseRequest(QByteArray&)), and for writing response headers (by implementing writeHeaders(QIODevice*, const QHttpResponseHeader&)).

See also QxtHttpSessionManager.


Member Function Documentation

QxtAbstractHttpConnector::QxtAbstractHttpConnector ( QObject * parent = 0 )

Creates a QxtAbstractHttpConnector with the specified parent.

Note that this is an abstract class and cannot be instantiated directly.

void QxtAbstractHttpConnector::addConnection ( QIODevice * device )   [protected]

Starts managing a new connection from device.

This function should be invoked by a subclass to attach incoming connections to the session manager.

bool QxtAbstractHttpConnector::canParseRequest ( const QByteArray & buffer )   [pure virtual protected]

Returns true if a complete set of request headers can be extracted from the provided buffer.

bool QxtAbstractHttpConnector::listen ( const QHostAddress & interface, quint16 port )   [pure virtual]

Invoked by the session manager to indicate that the connector should listen for incoming connections on the specified interface and port.

If the interface is QHostAddress::Any, the server will listen on all network interfaces.

Returns true on success, or false if the server could not begin listening.

See also addConnection(QIODevice*).

QHttpRequestHeader QxtAbstractHttpConnector::parseRequest ( QByteArray & buffer )   [pure virtual protected]

Extracts a set of request headers from the provided buffer.

Subclasses implementing this function must be sure to remove the parsed data from the buffer.

QxtHttpSessionManager * QxtAbstractHttpConnector::sessionManager () const   [protected]

Returns the session manager into which the connector is installed.

See also QxtHttpSessionManager::setConnector.

void QxtAbstractHttpConnector::writeHeaders ( QIODevice * device, const QHttpResponseHeader & header )   [pure virtual protected]

Writes a the response header to the specified device.


Copyright © 2007-2011 Qxt Foundation
Qxt 0.6.2