Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.servingxml.components.content.dynamic
Interface DynamicContentHandler

    public interface DynamicContentHandler

The `DynamicContentHandler` interface is a tagging interface that identifies an object as a source of dynamic content. The methods on a `DynamicContentHandler` instance are invoked by the ServingXML framework through reflection.

A `DynamicContentHandler` implementation services the request with a method of the form

        public void onRequest(ServiceContext context, Object parameters,
        ContentWriter contentWriter);

where the first parameter is a `ServiceContext`, the second parameter may be any user defined interface that follows bean naming conventions for accessors, and the third parameter wraps a SAX 2 `ContentHandler`.

The `onRequest` method is responsible for getting dynamic XML content (e.g. a document, results from a database query.) It can return dynamic XML content through a SAX 2 `ContentHandler`. This content may be cached depending on the settings for caching parameters in the resources script.

The classes responsible for fielding requests for documents implement this interface. These `DynamicContentHandler` classes are registered by name in a resources script.

When there is a request for a document associated with a `DynamicContentHandler`, the handler's `handleRequest` method is called with a request context, parameters and a SAX 2 `ContentHandler` to receive XML back. The handler could respond to the event by obtaining content from an external data source and feeding start/end elements back to the `ContentHandler`.

The com.servingxml.content package contains a number of helper classes that simplify the action of feeding start/end elements to the `ContentHandler`. See `ContentWriter`, `AttributeSet`,

All data members in a `DynamicContentHandler` implementation should be declared as final and initialized in the constructor. The `onRequest` method must be reentrant.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD