com.primix.tapestry
Interface IEngineService

All Known Implementing Classes:
AbstractService

public interface IEngineService

A service, provided by the IEngine, for its pages and/or components. Services are responsible for constructing Gestures (an encoding of URLs) to represent dynamic application behavior, and for parsing those URLs when a subsequent request involves them.

Version:
$Id: IEngineService.java,v 1.9 2001/08/07 20:12:27 hship Exp $
Author:
Howard Ship
See Also:
IEngine.getService(String)

Field Summary
static java.lang.String ACTION_SERVICE
          The name ("action") of a service that allows behavior to be associated with an IAction component, such as Action or Form.
static java.lang.String ASSET_SERVICE
          The name ("asset") of a service used to access internal assets.
static java.lang.String CONTEXT_QUERY_PARMETER_NAME
          The query parameter for additional context needed by the service.
static java.lang.String DIRECT_SERVICE
          The name ("direct") of a service that allows stateless behavior for an Direct component.
static java.lang.String HOME_SERVICE
          The name ("home") of a service that jumps to the home page.
static java.lang.String PAGE_SERVICE
          The name ("page") of a service that allows a new page to be selected.
static java.lang.String PARAMETERS_QUERY_PARAMETER_NAME
          The query parameter for application specific parameters to the service (this is used with the direct service).
static java.lang.String RESET_SERVICE
          The name ("reset") of a service used to clear cached template and specification data and remove all pooled pages.
static java.lang.String RESTART_SERVICE
          The name ("restart") of a service that invalidates the session and restarts the application.
static java.lang.String SERVICE_QUERY_PARAMETER_NAME
          The query parameter into which each engine service records its information when building a URL.
 
Method Summary
 Gesture buildGesture(IRequestCycle cycle, IComponent component, java.lang.String[] parameters)
          Builds a URL for a service.
 java.lang.String getName()
          Returns the name of the service.
 boolean service(IRequestCycle cycle, ResponseOutputStream output)
          Perform the service, interpreting the URL (from the HttpServletRequest) responding appropriately, and rendering a result page.
 

Field Detail

ACTION_SERVICE

public static final java.lang.String ACTION_SERVICE
The name ("action") of a service that allows behavior to be associated with an IAction component, such as Action or Form.

This service is used with actions that are tied to the dynamic state of the page, and which require a rewind of the page.


DIRECT_SERVICE

public static final java.lang.String DIRECT_SERVICE
The name ("direct") of a service that allows stateless behavior for an Direct component.

This service rolls back the state of the page but doesn't rewind the the dynamic state of the page the was the action service does, which is more efficient but less powerful.

An array of String parameters may be included with the service URL; these will be made available to the Direct component's listener.


PAGE_SERVICE

public static final java.lang.String PAGE_SERVICE
The name ("page") of a service that allows a new page to be selected. Associated with a Page component.

The service requires a single parameter: the name of the target page.


HOME_SERVICE

public static final java.lang.String HOME_SERVICE
The name ("home") of a service that jumps to the home page. A stand-in for when no service is provided, which is typically the entrypoint to the application.

RESTART_SERVICE

public static final java.lang.String RESTART_SERVICE
The name ("restart") of a service that invalidates the session and restarts the application. Typically used just to recover from an exception.

ASSET_SERVICE

public static final java.lang.String ASSET_SERVICE
The name ("asset") of a service used to access internal assets.

RESET_SERVICE

public static final java.lang.String RESET_SERVICE
The name ("reset") of a service used to clear cached template and specification data and remove all pooled pages. This is only used when debugging as a quick way to clear the out cached data, to allow updated versions of specifications and templates to be loaded (without stopping and restarting the servlet container).

This service is only available if the Java system property com.primix.tapestry.enable-reset-service is set to true.


SERVICE_QUERY_PARAMETER_NAME

public static final java.lang.String SERVICE_QUERY_PARAMETER_NAME
The query parameter into which each engine service records its information when building a URL.
Since:
1.0.3

CONTEXT_QUERY_PARMETER_NAME

public static final java.lang.String CONTEXT_QUERY_PARMETER_NAME
The query parameter for additional context needed by the service. This is used to store things like the page name or component id. When there are multiple pieces of data, they are seperated by slashes.
Since:
1.0.3

PARAMETERS_QUERY_PARAMETER_NAME

public static final java.lang.String PARAMETERS_QUERY_PARAMETER_NAME
The query parameter for application specific parameters to the service (this is used with the direct service). Each of these values is encoded with java.net.URLEncoder#encode(String) before being added to the URL. Multiple values are seperated with slashes.
Since:
1.0.3
Method Detail

buildGesture

public Gesture buildGesture(IRequestCycle cycle,
                            IComponent component,
                            java.lang.String[] parameters)
Builds a URL for a service. This is performed during the rendering phase of one request cycle and bulds URLs that will invoke activity in a subsequent request cycle.
Parameters:
cycle - Defines the request cycle being processed.
component - The component requesting the URL.
parameters - Additional parameters specific to the component requesting the Gesture.

service

public boolean service(IRequestCycle cycle,
                       ResponseOutputStream output)
                throws RequestCycleException,
                       ServletException,
                       java.io.IOException
Perform the service, interpreting the URL (from the HttpServletRequest) responding appropriately, and rendering a result page.

The return value indicates whether processing of the request could, in any way, change the state of the engine. Generally, this is true.

See Also:
IEngine.service(RequestContext)

getName

public java.lang.String getName()
Returns the name of the service.
Since:
1.0.1