QxtAbstractWebSessionManager Class Reference
[QxtWeb module]

Base class for QxtWeb session managers. More...

 #include <QxtAbstractWebSessionManager>

Inherits QObject.

Public Functions

Protected Functions

protected-slot


Detailed Description

QxtAbstractWebSessionManager is the base class for all QxtWeb session managers.

Session managers are responsible for managing connections between web browsers and web services, for creating sessions and their corresponding service objects, and for managing and dispatching events between browsers and services.

Note that the session manager is not responsible for destroying service objects. A service object that wishes to end its corresponding session may destroy itself (see QObject::deleteLater()) and QxtAbstractWebSessionManager will automatically clean up its internal session tracking data.

see See also: QxtAbstractWebService

Member Documentation

typedef QxtAbstractWebService * ServiceFactory ( QxtAbstractWebSessionManager * , int )

Pointer to a function that generates QxtAbstractWebService objects.

TYPEDEF: The ServiceFactory type represents a pointer to a function that takes two parameters -- a QxtAbstractWebSessionManager* pointer and an int session ID. The function must return a QxtAbstractWebService* pointer.

Usually, an application providing web services will instantiate one QxtAbstractWebService object for each session. For services that do not require session management, such as those that serve only static pages, a single service object may be shared for all requests, or it may use some more exotic scheme. See QxtAbstractWebService for more details.




QxtAbstractWebSessionManager ( QObject * parent = 0 )

Creates a QxtAbstractWebSessionManager with the specified parent.

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




virtual bool start ( ) =0

Starts the session manager.

Session managers should not create sessions before start() is invoked. Subclasses are encouraged to refrain from accepting connections until the session manager is started.




virtual void postEvent ( QxtWebEvent * event ) =0

Adds the event to the event queue for its associated session.

Since different protocols may require different event processing behavior, there is no default implementation in QxtAbstractWebSessionManager. Subclasses are responsible for maintaining event queues and deciding when and where to dispatch events.

Depending on the subclass's implementation posted events may not be dispatched for some time, and is is possible that an event may never be dispatched if the session is terminated before the event is handled.

see See also: QxtWebEvent




void setServiceFactory ( ServiceFactory * factory )

Sets the service factory for the session manager.

The service factory is invoked every time the session manager creates a new session. Usually, an application providing web services will instantiate one QxtAbstractWebService object for each session. For services that do not require separate sessions, such as those that serve only static pages, the factory may return a pointer to the same object for multiple requests.

see See also: QxtAbstractWebSessionManager::ServiceFactory




ServiceFactory * serviceFactory ( ) const

Returns the service factory in use by the session manager.

see See also: setServiceFactory(ServiceFactory*)




QxtAbstractWebService * session ( int sessionID ) const

Returns the service object corresponding to the provided session ID.




int createService ( )

Creates a new session and returns its session ID.

This function uses the serviceFactory() to request an instance of the web service.

see See also: serviceFactory()




virtual void processEvents ( ) =0

Processes pending events for all sessions.

Since different protocols may require different event processing behavior, there is no default implementation in QxtAbstractWebSessionManager. Subclasses are responsible for maintaining event queues and deciding when and where to dispatch events.

processEvents() is not required to dispatch all events immediately. In particular, some events may require certain conditions to be met before they may be fully processed. (For example, because HTTP cookies are sent as response headers, QxtHttpServerConnector may not dispatch a QxtWebStoreCookieEvent until a QxtWebPageEvent for the same session is available.) Unprocessed events may remain in the event queue.

see See also: QxtWebEvent






Copyright © 2007 Qxt Foundation Trademarks
Qt Extension Library 0.4