public abstract class GenericPortletBean extends javax.portlet.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() |
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) |
destroy, dispatchAnnotatedActionMethod, dispatchAnnotatedEventMethod, dispatchAnnotatedRenderMethod, doDispatch, doEdit, doHeaders, doHelp, doView, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletModes, getProcessingEventQNames, getPublicRenderParameterDefinitions, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, getWindowStates, init, processAction, processEvent, render, renderHeaders, serveResource
protected final Log logger
public ConfigurableEnvironment getEnvironment()
If null
, a new environment will be initialized via createEnvironment()
.
getEnvironment
in interface EnvironmentCapable
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()
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 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.public void setEnvironment(Environment environment)
setEnvironment
in interface EnvironmentAware
IllegalArgumentException
- if environment is not assignable to ConfigurableEnvironment
.protected final void addRequiredProperty(String property)
property
- name of the required propertyprotected ConfigurableEnvironment createEnvironment()
StandardPortletEnvironment
. Subclasses may override in order to configure the
environment or specialize the environment type returned.protected void initBeanWrapper(BeanWrapper bw) throws BeansException
bw
- the BeanWrapper to initializeBeansException
- if thrown by BeanWrapper methodsPropertyEditorRegistry.registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor)
protected void initPortletBean() throws javax.portlet.PortletException
javax.portlet.PortletException
- if subclass initialization failsCopyright © 2019 Liferay, Inc.. All rights reserved.