public class SpringBridgeHstComponent extends GenericHstComponent implements org.springframework.context.ApplicationListener
By default, the delegated bean's name should be configured in the component configuration parameter value with the parameter name, 'spring-delegated-bean-param-name'. This bridge component will retrieve the bean from the spring web application context by the bean name. If you want to change the default parameter name, then you can achieve that by configuring the parameter name with an added "hst-" prefix in the web.xml. For example, if you want to change the default parameter name to 'my-bean-param', then you can configure this like the following:
If the root web application context has hierarchical child bean factories and one of the
child bean factories has defined a bean you need, then you can set the bean name component
configuration parameter with context path prefix like the following example:
com.mycompany.myapp::contactBean
In the above example, 'com.mycompany.myapp' is the name of the child bean factory name,
and 'contactBean' is the bean name of the child bean factory.
The bean factory paths can be multiple to represent the hierarchy
like 'com.mycompany.myapp::crm::contactBean'.
The separator for hierarchical bean factory path can be changed by setting the webapp
init parameter, 'hst-spring-context-name-separator-param-name'.
Modifier and Type | Field and Description |
---|---|
protected String |
contextNameSeparator |
protected HstComponent |
delegatedBean |
protected org.springframework.context.support.AbstractApplicationContext |
delegatedBeanApplicationContext |
protected String |
delegatedBeanNameParamName |
RESOURCE_PATH_BY_RESOURCE_ID
Constructor and Description |
---|
SpringBridgeHstComponent() |
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
|
protected HstComponent |
getDelegatedBean(HstRequest request) |
protected String |
getParameter(String name,
HstRequest request) |
void |
init(javax.servlet.ServletContext servletContext,
ComponentConfiguration componentConfig)
Allows the component to initialize itself
|
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
getComponentConfiguration
protected String delegatedBeanNameParamName
protected String contextNameSeparator
protected org.springframework.context.support.AbstractApplicationContext delegatedBeanApplicationContext
protected HstComponent delegatedBean
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 destroy() throws HstComponentException
HstComponent
destroy
in interface HstComponent
destroy
in class GenericHstComponent
HstComponentException
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 String getParameter(String name, HstRequest request)
protected HstComponent getDelegatedBean(HstRequest request) throws HstComponentException
HstComponentException
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent
in interface org.springframework.context.ApplicationListener
Copyright © 2008-2013 Hippo B.V. (http://www.onehippo.com). All Rights Reserved.