public abstract class

GenericPortletBean

extends GenericPortlet
implements EnvironmentAware
java.lang.Object
   ↳ GenericPortlet
     ↳ org.springframework.web.portlet.GenericPortletBean
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Simple extension of 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.

Summary

Fields
protected final Log logger Logger available to subclasses
Public Constructors
GenericPortletBean()
Public Methods
final PortletContext getPortletContext()
Overridden method that simply returns null when no PortletConfig set yet.
final String getPortletName()
Overridden method that simply returns null when no PortletConfig set yet.
final void init()
Map config parameters onto bean properties of this portlet, and invoke subclass initialization.
void setEnvironment(Environment environment)
Set the Environment that this object runs in.

Any environment set here overrides the DefaultPortletEnvironment provided by default.

Protected Methods
final 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.
void initBeanWrapper(BeanWrapper bw)
Initialize the BeanWrapper for this GenericPortletBean, possibly with custom editors.
void initPortletBean()
Subclasses may override this to perform custom initialization.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.context.EnvironmentAware

Fields

protected final Log logger

Logger available to subclasses

Public Constructors

public GenericPortletBean ()

Public Methods

public final PortletContext getPortletContext ()

Overridden method that simply returns null when no PortletConfig set yet.

See Also
  • #getPortletConfig()

public final String getPortletName ()

Overridden method that simply returns null when no PortletConfig set yet.

See Also
  • #getPortletConfig()

public final void init ()

Map config parameters onto bean properties of this portlet, and invoke subclass initialization.

Throws
if bean properties are invalid (or required properties are missing), or if subclass initialization fails.
PortletException

public void setEnvironment (Environment environment)

Set the Environment that this object runs in.

Any environment set here overrides the DefaultPortletEnvironment provided by default.

Protected Methods

protected final 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. This method would normally be called from a subclass constructor.

Parameters
property name of the required property

protected void initBeanWrapper (BeanWrapper bw)

Initialize the BeanWrapper for this GenericPortletBean, possibly with custom editors.

Parameters
bw the BeanWrapper to initialize
Throws
BeansException if thrown by BeanWrapper methods

protected void initPortletBean ()

Subclasses may override this to perform custom initialization. All bean properties of this portlet will have been set before this method is invoked. This default implementation does nothing.

Throws
if subclass initialization fails
PortletException