public class SimpleDispatcherHstComponent extends GenericHstComponent
The dispatched servlet can detect which lifecycle phase of the current request is by retrieving request attribute.
LIFECYCLE_PHASE_ATTRIBUTE
is BEFORE_RENDER_PHASE
,
then the current request is dispatched via HstComponent.doBeforeRender(HstRequest, HstResponse)
.LIFECYCLE_PHASE_ATTRIBUTE
is BEFORE_RESOURCE_PHASE
,
then the current request is dispatched via HstComponent.doBeforeServeResource(HstRequest, HstResponse)
.HstRequest.getLifecyclePhase()
returns HstRequest.ACTION_PHASE
,
then the current request is dispatched via HstComponent.doAction(HstRequest, HstResponse)
.HstRequest.getLifecyclePhase()
returns HstRequest.RENDER_PHASE
,
then the current request is dispatched via renderpath
.HstRequest.getLifecyclePhase()
returns HstRequest.RESOURCE_PHASE
,
then the current request is dispatched via serveresourcepath
.Modifier and Type | Field and Description |
---|---|
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.
|
RESOURCE_PATH_BY_RESOURCE_ID
Constructor and Description |
---|
SimpleDispatcherHstComponent() |
Modifier and Type | Method and Description |
---|---|
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
|
destroy, getComponentConfiguration
public static final String LIFECYCLE_PHASE_ATTRIBUTE
public static final String BEFORE_RENDER_PHASE
public static final String BEFORE_RESOURCE_PHASE
public static final String DISPATCH_PATH_PARAM_NAME
public static final String BEFORE_RENDER_PATH_PARAM_NAME
BEFORE_RENDER_PHASE
.
This component would dispatch to this path in its doBeforeRender(HstRequest, HstResponse)
.public static final String RENDER_PATH_PARAM_NAME
RENDER_PHASE
.
This component would dispatch to this path in its #doRender(HstRequest, HstResponse)
.public static final String ACTION_PATH_PARAM_NAME
ACTION_PHASE
.
This component would dispatch to this path in its doAction(HstRequest, HstResponse)
.public static final String BEFORE_RESOURCE_PATH_PARAM_NAME
BEFORE_RESOURCE_PHASE
.
This component would dispatch to this path in its #doBeforeResource(HstRequest, HstResponse)
.public static final String RESOURCE_PATH_PARAM_NAME
RESOURCE_PHASE
.
This component would dispatch to this path in its #doServeResource(HstRequest, HstResponse)
.public static final String SHARED_REQUEST_ATTRIBUTES_PARAM_NAME
public static final String SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME
public static final String DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX
public void init(javax.servlet.ServletContext servletContext, ComponentConfiguration componentConfig) throws HstComponentException
HstComponent
init
in interface HstComponent
init
in class GenericHstComponent
servletContext
- the servletConfig of the HST container servletcomponentConfig
- the componentConfigBean configurationHstComponentException
public void doAction(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doAction
in interface HstComponent
doAction
in class GenericHstComponent
HstComponentException
public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doBeforeRender
in interface HstComponent
doBeforeRender
in class GenericHstComponent
HstComponentException
public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doBeforeServeResource
in interface HstComponent
doBeforeServeResource
in class GenericHstComponent
HstComponentException
protected void doDispatch(String dispatchPath, HstRequest request, HstResponse response) throws HstComponentException
HstComponentException
protected String getDispatchPathParameter(HstRequest request, String lifecyclePhase)
protected String getParameter(String name, HstRequest request, String defaultValue)
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.