Package org.hippoecm.hst.core.component
Class GenericHstComponent
- java.lang.Object
-
- org.hippoecm.hst.core.component.GenericHstComponent
-
- All Implemented Interfaces:
HstComponent
public class GenericHstComponent extends Object implements HstComponent
TheGenericHstComponent
class provides a default implementation for theHstComponent
interface. It provides a base class to be subclassed to create HstComponents. Common practice is thatHstComponentConfiguration
's whose only purpose is layout (markup) and do not have actual behavior, use this defaultHstComponent
implementation as their component classname, seeHstComponentInfo.getComponentClassName()
. A subclass ofGenericHstComponent
can override methods, usually one of the following:- doAction, to handle action requests
- doBeforeRender, to retrieve model objects from the repository to be passed to the rendering page or servlet
- doBeforeServeResource, to retrieve model objects from the repository to be passed to the resource serving page or servlet
- init and destroy, to manage resources that are held for the life of the HstComponent
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, seeHstComponent
). Shared resources include in-memory data such as instance or class variables and external objects such as files, database connections, and network connections.- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description GenericHstComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Allows the component to destroy itselfvoid
doAction(HstRequest request, HstResponse response)
Allows the component to process actionsvoid
doBeforeRender(HstRequest request, HstResponse response)
Allows the component to do some business logic processing before renderingvoid
doBeforeServeResource(HstRequest request, HstResponse response)
Allows the component to do some business logic processing before serving resourceComponentConfiguration
getComponentConfiguration()
Returns the ComponentConfiguration for this component ornull
if not implemented by a subclassvoid
init(javax.servlet.ServletContext servletContext, ComponentConfiguration componentConfig)
Allows the component to initialize itself-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hippoecm.hst.core.component.HstComponent
prepareBeforeRender
-
-
-
-
Field Detail
-
RESOURCE_PATH_BY_RESOURCE_ID
public static final String RESOURCE_PATH_BY_RESOURCE_ID
Configuration key for flag whether or not to allow resource path resolving by resourceID as fallback.- See Also:
- Constant Field Values
-
-
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 interfaceHstComponent
- Parameters:
servletContext
- the servletConfig of the HST container servletcomponentConfig
- the componentConfigBean configuration- Throws:
HstComponentException
-
destroy
public void destroy() throws HstComponentException
Description copied from interface:HstComponent
Allows the component to destroy itself- Specified by:
destroy
in interfaceHstComponent
- 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 interfaceHstComponent
- 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 interfaceHstComponent
- 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 interfaceHstComponent
- Throws:
HstComponentException
-
getComponentConfiguration
public ComponentConfiguration getComponentConfiguration()
Description copied from interface:HstComponent
Returns the ComponentConfiguration for this component ornull
if not implemented by a subclass- Specified by:
getComponentConfiguration
in interfaceHstComponent
-
-