public abstract class GenericPortletBean extends GenericPortlet implements EnvironmentCapable, EnvironmentAware
javax.portlet.GenericPortlet that treats
its config parameters as bean properties.
A very handy superclass for any type of portlet. Type conversion is automatic. It is also possible for subclasses to specify required properties.
This portlet leaves request handling to subclasses, inheriting the default
behaviour of GenericPortlet (doDispatch, processAction, etc).
This portlet superclass has no dependency on a Spring application context, in contrast to the FrameworkPortlet class which loads its own context.
addRequiredProperty(java.lang.String),
initPortletBean(),
GenericPortlet.doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse),
GenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse),
FrameworkPortlet| Modifier and Type | Field and Description |
|---|---|
protected Log |
logger
Logger available to subclasses
|
| Constructor and Description |
|---|
GenericPortletBean() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addRequiredProperty(String property)
Subclasses can invoke this method to specify that this property
(which must match a JavaBean property they expose) is mandatory,
and must be supplied as a config parameter.
|
protected ConfigurableEnvironment |
createEnvironment()
Create and return a new
StandardPortletEnvironment. |
ConfigurableEnvironment |
getEnvironment()
Return the
Environment associated with this component
(may be null or a default environment). |
PortletContext |
getPortletContext()
Overridden method that simply returns
null when no
PortletConfig set yet. |
String |
getPortletName()
Overridden method that simply returns
null when no
PortletConfig set yet. |
void |
init()
Map config parameters onto bean properties of this portlet, and
invoke subclass initialization.
|
protected void |
initBeanWrapper(BeanWrapper bw)
Initialize the BeanWrapper for this GenericPortletBean,
possibly with custom editors.
|
protected void |
initPortletBean()
Subclasses may override this to perform custom initialization.
|
void |
setEnvironment(Environment environment)
Set the
Environment that this component runs in. |
destroy, doDispatch, doEdit, doHeaders, doHelp, doView, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processAction, processEvent, render, serveResourceprotected final Log logger
protected final void addRequiredProperty(String property)
property - name of the required propertypublic final void init()
throws PortletException
init in class GenericPortletPortletException - if bean properties are invalid (or required
properties are missing), or if subclass initialization fails.protected void initBeanWrapper(BeanWrapper bw) throws BeansException
bw - the BeanWrapper to initializeBeansException - if thrown by BeanWrapper methodsPropertyEditorRegistry.registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor)public final String getPortletName()
null when no
PortletConfig set yet.getPortletName in interface PortletConfiggetPortletName in class GenericPortletGenericPortlet.getPortletConfig()public final PortletContext getPortletContext()
null when no
PortletConfig set yet.getPortletContext in interface PortletConfiggetPortletContext in class GenericPortletGenericPortlet.getPortletConfig()protected void initPortletBean()
throws PortletException
PortletException - if subclass initialization failspublic void setEnvironment(Environment environment)
Environment that this component runs in.setEnvironment in interface EnvironmentAwareIllegalArgumentException - if environment is not assignable to
ConfigurableEnvironment.public ConfigurableEnvironment getEnvironment()
Environment associated with this component
(may be null or a default environment).
If null, a new environment will be initialized via
createEnvironment().
getEnvironment in interface EnvironmentCapableprotected ConfigurableEnvironment createEnvironment()
StandardPortletEnvironment. Subclasses may override
in order to configure the environment or specialize the environment type returned.