Package org.hippoecm.hst.core.component
Class GenericHstComponent
java.lang.Object
org.hippoecm.hst.core.component.GenericHstComponent
- All Implemented Interfaces:
HstComponent
The
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:
- 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, 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.- Version:
- $Id$
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Configuration key for flag whether or not to allow resource path resolving by resourceID as fallback. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 resourceReturns the ComponentConfiguration for this component ornull
if not implemented by a subclassvoid
init
(jakarta.servlet.ServletContext servletContext, ComponentConfiguration componentConfig) Allows the component to initialize itselfMethods 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 Details
-
RESOURCE_PATH_BY_RESOURCE_ID
Configuration key for flag whether or not to allow resource path resolving by resourceID as fallback.- See Also:
-
-
Constructor Details
-
GenericHstComponent
public GenericHstComponent()
-
-
Method Details
-
init
public void init(jakarta.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
Description copied from interface:HstComponent
Allows the component to destroy itself- Specified by:
destroy
in interfaceHstComponent
- Throws:
HstComponentException
-
doAction
Description copied from interface:HstComponent
Allows the component to process actions- Specified by:
doAction
in interfaceHstComponent
- Throws:
HstComponentException
-
doBeforeRender
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
Description copied from interface:HstComponent
Returns the ComponentConfiguration for this component ornull
if not implemented by a subclass- Specified by:
getComponentConfiguration
in interfaceHstComponent
-