![]() |
Home · Modules · Classes · Namespaces · Functions |
The QxtAbstractWebService class is a base interface for web services More...
#include <QxtAbstractWebService>
Inherits QObject.
Inherited by QxtWebCgiService, QxtWebServiceDirectory, and QxtWebSlotService.
The QxtAbstractWebService class is a base interface for web services
QxtAbstractWebService provides a common interface for all web service classes. It uses an event-driven design instead of the more traditional request-response design used by many web scripting languages. When the user requests a web page, the service receives a pageRequestedEvent; after the service assembles the response, it must post a QxtWebPageEvent (or a subclass, such as QxtWebRedirectEvent or QxtWebErrorEvent).
Usually, an application providing web services will instantiate one QxtAbstractWebService object for each session, but this is not a requirement. For services that do not require session management, such as those that serve only static content, the session factory may return the same pointer for every invocation, or it may use some more exotic scheme.
When using one service object per session, each service's data members are independent and may be used to track state across requests. A service object shared among multiple sessions will retain state across requests as well but it must implement its own mechanism for separating non-shared data.
The QxtWeb architecture is not multithreaded; that is, QxtAbstractWebService does not automatically spawn a process for every session. However, QxtAbstractWebSessionManager performs thread-safe event dispatching, so subclasses of QxtAbstractWebService are free to create threads themselves.
A web service object may delete itself (see QObject::deleteLater()) to end the associated session.
See also QxtAbstractWebSessionManager::ServiceFactory.
Creates a QxtAbstractWebService with the specified parent and session manager.
Often, the session manager will also be the parent, but this is not a requirement.
Note that this is an abstract class and cannot be instantiated directly.
This event handler must be reimplemented in subclasses to receive page request events.
Every page request event received MUST be responded to with a QxtWebPageEvent or a QxtWebPageEvent subclass. This response does not have to be posted during the execution of this function, to support asynchronous design, but failure to post an event will cause the web browser making the request to wait until it times out.
See also QxtWebRequestEvent.
Posts an event to a web browser that has made a request to the service.
Returns the session manager associated with the web service.
Copyright © 2007-2011 Qxt Foundation |
Qxt 0.6.2 |