public class GenericHstComponent extends Object implements HstComponent
GenericHstComponent
class provides a default implementation for
the HstComponent
interface.
It provides a base class to be subclassed to create HstComponents. Common practice is that
HstComponentConfiguration
's whose only purpose is layout (markup) and do not have
actual behavior, use this default HstComponent
implementation as their component classname,
see HstComponentInfo.getComponentClassName()
.
A subclass of GenericHstComponent
can override methods, usually
one of the following:
HstComponent
's typically run multi threaded, so take care that a
HstComponent must handle concurrent requests and be careful to synchronize access
to shared resources (in other words, be thread safe, see HstComponent
). Shared resources include in-memory data such as
instance or class variables and external objects such as files, database connections, and network connections.Modifier and Type | Field and Description |
---|---|
static String |
RESOURCE_PATH_BY_RESOURCE_ID
Configuration key for flag whether or not to allow resource path resolving by resourceID as fallback.
|
Constructor and Description |
---|
GenericHstComponent() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Allows the component to destroy itself
|
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
|
ComponentConfiguration |
getComponentConfiguration()
Returns the ComponentConfiguration for this component or
null
if not implemented by a subclass |
void |
init(javax.servlet.ServletContext servletContext,
ComponentConfiguration componentConfig)
Allows the component to initialize itself
|
public static final String RESOURCE_PATH_BY_RESOURCE_ID
public void init(javax.servlet.ServletContext servletContext, ComponentConfiguration componentConfig) throws HstComponentException
HstComponent
init
in interface HstComponent
servletContext
- the servletConfig of the HST container servletcomponentConfig
- the componentConfigBean configurationHstComponentException
public void destroy() throws HstComponentException
HstComponent
destroy
in interface HstComponent
HstComponentException
public void doAction(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doAction
in interface HstComponent
HstComponentException
public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doBeforeRender
in interface HstComponent
HstComponentException
public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException
HstComponent
doBeforeServeResource
in interface HstComponent
HstComponentException
public ComponentConfiguration getComponentConfiguration()
HstComponent
null
if not implemented by a subclassgetComponentConfiguration
in interface HstComponent
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.