Home | | Sitemap ||Page number :9

4.3 Server Extension API

The Nokia WAP Server provides an open architecture for WAP development. The Server Extension API is a group of interfaces defined by the Nokia WAP Server that are used by the Nokia WAP Server itself or by servlets. A servlet may provide an implementation of one of the defined interfaces and thus customise the server operation to meet specific needs.

All server extensions must provide the Servletinterface. It is used to load, initialise and destroy the servlet instance. Servlets providing an implementation of some interface in the Server Extension API may provide an empty service()method in the Java Servlet API, because the servlet does not provide any direct service for requests and thus the service() method is never called. A URL mapping to the servlet does not need to exist.

For example, if a developer implements a more advanced access log writing functionality that integrates the Nokia WAP Server logging into an existing billing system, the developer will:

1 Implement a servlet that provides the Servlet interface and AccessLogWriter interface.

2 In a servlet.init()call made by the Nokia WAP Server, register the exposed

AccessLogWriterinterface to the Nokia WAP Server via the

com.nokia.wap.server.WapServerinterface by using the

registerExtensionService()method.

3 When an event to be written to the access log occurs inside the Nokia WAP Server,

the logAccess() method of the registered interface is called and the server

extension has all the information there is in the access log entry.

4 The Nokia WAP Server never calls the service() method of the servlet if there is no URL mapping defined for the servlet.

If a servlet wants to use a server extension, the com.nokia.wap.server.WapServer interface provides methods for locating an implementation.

For each interface, it is defined whether there can be several registered implementations.

The following interfaces have been defined for the Nokia WAP Server 1.1 release: For a detailed description of the interfaces, see the enclosed Nokia WAP Server API reference.

Interface Purpose
AccessLogWriter Provides a customised log writer for access information. Can be used to e.g. collect billing information.
AlarmHandler Enables an extension to receive and handle alarms generated in the Nokia WAP Server. Using this interface, a WAP Server extension can integrate to existing alarm management software.