Back to HTTPServer Main Index

Pluggable Services Help index


Overview

HTTPServices are objects which are responsible for handling http requests. They register themself at a server under a so called linkName (or multiple link names). Typically, the linkname is the top-component of an URL path - for example: "/foo".
For any incoming request, the http-server selects the service based on the requests URL and forwards the request to the service, which has to generate a response (typically, HTML, XML text or bitmap images).

Due to the historic evolution of the web server, there are two different schemes for service handling:

In order to allow for easy migration of applications based on these packages, the ST/X webServer supports both schemes.
However, we think that the HTTPActionService scheme (single processing method) is better and more flexible, and we therefore recommend using that for new applications.

HTTPSelectorService

HTTPSelectorServices must provide a list of allowed service selectors and a default service selector.
For any incoming request, the URL component AFTER the linkName is extracted and taken as a message selector. I.e. if the URL is "/foo/bar", the service registered under the "/foo" linkName gets a "bar:" message.
If the URL is the linkName alone (i.e. no component after the linkName), the default selector is used.
If a selector is not allowed, the server responds with an "Illegal Message" response.

HTTPActionService

HTTPActionServices will always receive a "process:" message, with the request as argument. They are free to (and actually responsible for) interpreting the URL and dispatching to any internal method.

Available Services

Presents a list of available services (all subclasses of the HTTPService class). Use the down arrow button to add the selected service to the server (i.e. to register).

Registered Services

Presents a list of all registered services for the server. Every service has the following properties:

Dealing with Services

Service Request Context

To aid in programming threadsafe services, the HTTPServiceRequestContext-class provides an interface to be inherited from.
This allows you to store variables on a per request basis. For every request an instance of your subclass is created where the instance variable request is set. Before passing through the service, initialize is called where you can do your own initialization of your variables. This enables you to have request dependent state. At the end of the request release is called. Redefine the class method requestContextClass: for your service that returns your subclass of HTTPServiceRequestContext.

Reply Presenter

The reply presenters repsonsibility is to wrap a generated HTML-page and generate a common frame around it for a nice common style. Already provied are the default presenter (which generates nothing and leaves the pages as-is) and the exept reply presenter, which generates a greenish exept-style frame with home-button. This is mostly provided as an example.

To create your own Reply Presenter, create a subclass of ReplyPresenter. and implement the required protocol (use the browser - luke).

Useful Helper Services

Even programatic services (such as the HomePageService, STT- or Swiki-Services) often generate references to common files such as icons, bitmap images etc.
Typically, a FileService is used for this and automatically installed/deinstalled with the service.

In addition, other useful services are provided by the HTTPUtilityService; Currently, this provides an accessCounter service, but more utilities are probably to be added in the future.


Copyright © 2003 eXept Software AG, all rights reserved


Doc $Revision: 1.4 $ $Date: 1997/08/07 15:06:09 $