public abstract class GenericPortletBean extends javax.portlet.GenericPortlet implements 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 org.apache.commons.logging.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.
|
javax.portlet.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 object runs in. |
destroy, doDispatch, doEdit, doHeaders, doHelp, doView, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processAction, processEvent, render, serveResource
protected final org.apache.commons.logging.Log logger
protected final void addRequiredProperty(String property)
property
- name of the required propertypublic final void init() throws javax.portlet.PortletException
init
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
- 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 javax.portlet.PortletConfig
getPortletName
in class javax.portlet.GenericPortlet
GenericPortlet.getPortletConfig()
public final javax.portlet.PortletContext getPortletContext()
null
when no
PortletConfig set yet.getPortletContext
in interface javax.portlet.PortletConfig
getPortletContext
in class javax.portlet.GenericPortlet
GenericPortlet.getPortletConfig()
protected void initPortletBean() throws javax.portlet.PortletException
javax.portlet.PortletException
- if subclass initialization failspublic void setEnvironment(Environment environment)
Environment
that this object runs in.
Any environment set here overrides the StandardPortletEnvironment
provided by default.
setEnvironment
in interface EnvironmentAware
Copyright © 2014. All rights reserved.