org.hippoecm.hst.component.support
Class SimpleDispatcherHstComponent

java.lang.Object
  extended by org.hippoecm.hst.core.component.GenericHstComponent
      extended by org.hippoecm.hst.component.support.SimpleDispatcherHstComponent
All Implemented Interfaces:
HstComponent

public class SimpleDispatcherHstComponent
extends GenericHstComponent

A bridge component which simply delegates all invocation to the dispatch path. So, the dispatched servlet should do every necessary things.

The dispatched servlet can detect which lifecycle phase of the current request is by retrieving request attribute.

Version:
$Id: SimpleDispatcherHstComponent.java 28929 2011-07-13 09:47:11Z aschrijvers $

Field Summary
static String ACTION_PATH_PARAM_NAME
          The parameter name for the dispatch path for ACTION_PHASE.
static String BEFORE_RENDER_PATH_PARAM_NAME
          The parameter name for the dispatch path for BEFORE_RENDER_PHASE.
static String BEFORE_RENDER_PHASE
           
static String BEFORE_RESOURCE_PATH_PARAM_NAME
          The parameter name for the dispatch path for BEFORE_RESOURCE_PHASE.
static String BEFORE_RESOURCE_PHASE
           
static String DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX
          The default session attribute name prefix to store shared request attributes during action phase.
static String DISPATCH_PATH_PARAM_NAME
          The parameter name for the default dispatch path for every invocation.
static String LIFECYCLE_PHASE_ATTRIBUTE
           
static String RENDER_PATH_PARAM_NAME
          The parameter name for the dispatch path for RENDER_PHASE.
static String RESOURCE_PATH_PARAM_NAME
          The parameter name for the dispatch path for RESOURCE_PHASE.
static String SHARED_REQUEST_ATTRIBUTES_PARAM_NAME
          The parameter name for the flag if the request attributes set during action phase are passed into render phase.
static String SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME
          The parameter name for the session attribute name by which the request attributes during action phase are stored temporarily to pass the attributes to request of the following render phase.
 
Fields inherited from class org.hippoecm.hst.core.component.GenericHstComponent
RESOURCE_PATH_BY_RESOURCE_ID
 
Constructor Summary
SimpleDispatcherHstComponent()
           
 
Method Summary
 void doAction(HstRequest request, HstResponse response)
          Allows the component to process actions
 void doBeforeRender(HstRequest request, HstResponse response)
          Allows the component to do some business logic processing before rendering
 void doBeforeServeResource(HstRequest request, HstResponse response)
          Allows the component to do some business logic processing before serving resource
protected  void doDispatch(String dispatchPath, HstRequest request, HstResponse response)
           
protected  String getDispatchPathParameter(HstRequest request, String lifecyclePhase)
           
protected  String getParameter(String name, HstRequest request, String defaultValue)
           
 void init(javax.servlet.ServletContext servletContext, ComponentConfiguration componentConfig)
          Allows the component to initialize itself
 
Methods inherited from class org.hippoecm.hst.core.component.GenericHstComponent
destroy, getComponentConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIFECYCLE_PHASE_ATTRIBUTE

public static final String LIFECYCLE_PHASE_ATTRIBUTE

BEFORE_RENDER_PHASE

public static final String BEFORE_RENDER_PHASE
See Also:
Constant Field Values

BEFORE_RESOURCE_PHASE

public static final String BEFORE_RESOURCE_PHASE
See Also:
Constant Field Values

DISPATCH_PATH_PARAM_NAME

public static final String DISPATCH_PATH_PARAM_NAME
The parameter name for the default dispatch path for every invocation. If you set this parameter in the configuration, the servlet indicated by this path should handle everything by itself.

See Also:
Constant Field Values

BEFORE_RENDER_PATH_PARAM_NAME

public static final String BEFORE_RENDER_PATH_PARAM_NAME
The parameter name for the dispatch path for BEFORE_RENDER_PHASE. This component would dispatch to this path in its doBeforeRender(HstRequest, HstResponse).

See Also:
Constant Field Values

RENDER_PATH_PARAM_NAME

public static final String RENDER_PATH_PARAM_NAME
The parameter name for the dispatch path for RENDER_PHASE. This component would dispatch to this path in its #doRender(HstRequest, HstResponse).

See Also:
Constant Field Values

ACTION_PATH_PARAM_NAME

public static final String ACTION_PATH_PARAM_NAME
The parameter name for the dispatch path for ACTION_PHASE. This component would dispatch to this path in its doAction(HstRequest, HstResponse).

See Also:
Constant Field Values

BEFORE_RESOURCE_PATH_PARAM_NAME

public static final String BEFORE_RESOURCE_PATH_PARAM_NAME
The parameter name for the dispatch path for BEFORE_RESOURCE_PHASE. This component would dispatch to this path in its #doBeforeResource(HstRequest, HstResponse).

See Also:
Constant Field Values

RESOURCE_PATH_PARAM_NAME

public static final String RESOURCE_PATH_PARAM_NAME
The parameter name for the dispatch path for RESOURCE_PHASE. This component would dispatch to this path in its #doServeResource(HstRequest, HstResponse).

See Also:
Constant Field Values

SHARED_REQUEST_ATTRIBUTES_PARAM_NAME

public static final String SHARED_REQUEST_ATTRIBUTES_PARAM_NAME
The parameter name for the flag if the request attributes set during action phase are passed into render phase.

See Also:
Constant Field Values

SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME

public static final String SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME
The parameter name for the session attribute name by which the request attributes during action phase are stored temporarily to pass the attributes to request of the following render phase.

See Also:
Constant Field Values

DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX

public static final String DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX
The default session attribute name prefix to store shared request attributes during action phase.

Constructor Detail

SimpleDispatcherHstComponent

public SimpleDispatcherHstComponent()
Method Detail

init

public void init(javax.servlet.ServletContext servletContext,
                 ComponentConfiguration componentConfig)
          throws HstComponentException
Description copied from interface: HstComponent
Allows the component to initialize itself

Specified by:
init in interface HstComponent
Overrides:
init in class GenericHstComponent
Parameters:
servletContext - the servletConfig of the HST container servlet
componentConfig - the componentConfigBean configuration
Throws:
HstComponentException

doAction

public void doAction(HstRequest request,
                     HstResponse response)
              throws HstComponentException
Description copied from interface: HstComponent
Allows the component to process actions

Specified by:
doAction in interface HstComponent
Overrides:
doAction in class GenericHstComponent
Throws:
HstComponentException

doBeforeRender

public void doBeforeRender(HstRequest request,
                           HstResponse response)
                    throws HstComponentException
Description copied from interface: HstComponent
Allows the component to do some business logic processing before rendering

Specified by:
doBeforeRender in interface HstComponent
Overrides:
doBeforeRender in class GenericHstComponent
Throws:
HstComponentException

doBeforeServeResource

public void doBeforeServeResource(HstRequest request,
                                  HstResponse response)
                           throws HstComponentException
Description copied from interface: HstComponent
Allows the component to do some business logic processing before serving resource

Specified by:
doBeforeServeResource in interface HstComponent
Overrides:
doBeforeServeResource in class GenericHstComponent
Throws:
HstComponentException

doDispatch

protected void doDispatch(String dispatchPath,
                          HstRequest request,
                          HstResponse response)
                   throws HstComponentException
Throws:
HstComponentException

getDispatchPathParameter

protected String getDispatchPathParameter(HstRequest request,
                                          String lifecyclePhase)

getParameter

protected String getParameter(String name,
                              HstRequest request,
                              String defaultValue)


Copyright © 2008-2012 Hippo. All Rights Reserved.