Ancillary Services

Echo Services are classes which produce responses to HTTP requests from the client browser. All Echo services implement the nextapp.echoservlet.Service interface. In order to be used, a service must first be registered with the application container. When a service is no longer needed, it should be unregistered.

Ancillary services are services that are required by a component. The ComponentPeer class, from which all rendered components are derived, will automatically register and unregister ancillary services for the component.

Ancillary services may be added to a component by calling the addAncillaryService() method of ComponentPeer:

addAncillaryService(service)

Once the service has been added, it will automatically be registered and unregistered with the application container when necessary. Ancillary services can also be removed if desired, by calling the removeAncillaryService() method of ComponentPeer.

To obtain the URI of a service, you should use the getServiceUri() method in nextapp.echoservlet.ClientObjects. The getServiceUri() method requires a nextapp.echoservlet.Connection to be passed to it order to determine the URI:

public void render(RenderingContext rc, Element parent) {
    :
    String uri = ClientObjects.getServiceUri(
            rc.getConnection(), service);
    :
}

For more information on ancillary services, see the Application Container API Specification.