类 GenericPortletBean
- java.lang.Object
- javax.portlet.GenericPortlet
- org.springframework.web.portlet.GenericPortletBean
- 所有已实现的接口:
EventPortlet
,Portlet
,PortletConfig
,ResourceServingPortlet
,Aware
,EnvironmentAware
,EnvironmentCapable
- 直接已知子类:
FrameworkPortlet
public abstract class GenericPortletBean extends GenericPortlet implements EnvironmentCapable, EnvironmentAware
Simple extension ofjavax.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.
- 从以下版本开始:
- 2.0
- 作者:
- William G. Thompson, Jr., John A. Lewis, Juergen Hoeller
- 另请参阅:
addRequiredProperty(java.lang.String)
,initPortletBean()
,GenericPortlet.doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
,GenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
,FrameworkPortlet
构造器概要
构造器 构造器 说明 GenericPortletBean()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 newStandardPortletEnvironment
.ConfigurableEnvironment
getEnvironment()
Return theEnvironment
associated with this component (may benull
or a default environment).PortletContext
getPortletContext()
Overridden method that simply returnsnull
when no PortletConfig set yet.String
getPortletName()
Overridden method that simply returnsnull
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 theEnvironment
that this component runs in.从类继承的方法 javax.portlet.GenericPortlet
destroy, doDispatch, doEdit, doHeaders, doHelp, doView, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processAction, processEvent, render, serveResource
构造器详细资料
GenericPortletBean
public GenericPortletBean()
方法详细资料
addRequiredProperty
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.- 参数:
property
- name of the required property
init
public final void init() throws PortletException
Map config parameters onto bean properties of this portlet, and invoke subclass initialization.- 覆盖:
init
在类中GenericPortlet
- 抛出:
PortletException
- if bean properties are invalid (or required properties are missing), or if subclass initialization fails.
initBeanWrapper
protected void initBeanWrapper(BeanWrapper bw) throws BeansException
Initialize the BeanWrapper for this GenericPortletBean, possibly with custom editors.- 参数:
bw
- the BeanWrapper to initialize- 抛出:
BeansException
- if thrown by BeanWrapper methods- 另请参阅:
PropertyEditorRegistry.registerCustomEditor(java.lang.Class<?>, java.beans.PropertyEditor)
getPortletName
public final String getPortletName()
Overridden method that simply returnsnull
when no PortletConfig set yet.- 指定者:
getPortletName
在接口中PortletConfig
- 覆盖:
getPortletName
在类中GenericPortlet
- 另请参阅:
GenericPortlet.getPortletConfig()
getPortletContext
public final PortletContext getPortletContext()
Overridden method that simply returnsnull
when no PortletConfig set yet.
initPortletBean
protected void initPortletBean() throws PortletException
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.- 抛出:
PortletException
- if subclass initialization fails
setEnvironment
public void setEnvironment(Environment environment)
Set theEnvironment
that this component runs in.- 指定者:
setEnvironment
在接口中EnvironmentAware
- 抛出:
IllegalArgumentException
- if environment is not assignable toConfigurableEnvironment
.
getEnvironment
public ConfigurableEnvironment getEnvironment()
Return theEnvironment
associated with this component (may benull
or a default environment).If
null
, a new environment will be initialized viacreateEnvironment()
.- 指定者:
getEnvironment
在接口中EnvironmentCapable
createEnvironment
protected ConfigurableEnvironment createEnvironment()
Create and return a newStandardPortletEnvironment
. Subclasses may override in order to configure the environment or specialize the environment type returned.