java.lang.Object
   ↳ org.springframework.context.support.ApplicationObjectSupport
     ↳ org.springframework.web.portlet.context.PortletApplicationObjectSupport
       ↳ org.springframework.web.portlet.handler.PortletContentGenerator
         ↳ org.springframework.web.portlet.mvc.AbstractController
           ↳ org.springframework.web.portlet.mvc.PortletWrappingController

Class Overview

Controller implementation that wraps a portlet instance which it manages internally. Such a wrapped portlet is not known outside of this controller; its entire lifecycle is covered here.

Useful to invoke an existing portlet via Spring's dispatching infrastructure, for example to apply Spring HandlerInterceptors to its requests.

Example:

<bean id="wrappingController" class="org.springframework.web.portlet.mvc.PortletWrappingController">
   <property name="portletClass">
     <value>org.springframework.web.portlet.sample.HelloWorldPortlet</value>
   </property>
   <property name="portletName">
     <value>hello-world</value>
   </property>
   <property name="initParameters">
     <props>
       <prop key="config">/WEB-INF/hello-world-portlet-config.xml</prop>
     </props>
   </property>
 </bean>

Summary

[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
PortletWrappingController()
Public Methods
void afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
void destroy()
Invoked by a BeanFactory on destruction of a singleton.
void handleEventRequest(EventRequest request, EventResponse response)
Process the event request.
ModelAndView handleResourceRequest(ResourceRequest request, ResourceResponse response)
Process the resource request and return a ModelAndView object which the DispatcherPortlet will render.
void setBeanName(String name)
Set the name of the bean in the bean factory that created this bean.
void setInitParameters(Map<StringString> initParameters)
Specify init parameters for the portlet to wrap, as name-value pairs.
void setPortletClass(Class portletClass)
Set the class of the Portlet to wrap.
void setPortletConfig(PortletConfig portletConfig)
Set the PortletConfigthat this object runs in.
void setPortletContext(PortletContext portletContext)
Set the PortletContext that this object runs in.
void setPortletName(String portletName)
Set the name of the Portlet to wrap.
void setUseSharedPortletConfig(boolean useSharedPortletConfig)
Set whether to use the shared PortletConfig object passed in through setPortletConfig, if available.
Protected Methods
void handleActionRequestInternal(ActionRequest request, ActionResponse response)
Subclasses are meant to override this method if the controller is expected to handle action requests.
ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response)
Subclasses are meant to override this method if the controller is expected to handle render requests.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.mvc.AbstractController
From class org.springframework.web.portlet.handler.PortletContentGenerator
From class org.springframework.web.portlet.context.PortletApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.beans.factory.BeanNameAware
From interface org.springframework.beans.factory.DisposableBean
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.portlet.context.PortletConfigAware
From interface org.springframework.web.portlet.context.PortletContextAware
From interface org.springframework.web.portlet.mvc.Controller
From interface org.springframework.web.portlet.mvc.EventAwareController
From interface org.springframework.web.portlet.mvc.ResourceAwareController

Public Constructors

public PortletWrappingController ()

Public Methods

public void afterPropertiesSet ()

Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Throws
Exception

public void destroy ()

Invoked by a BeanFactory on destruction of a singleton.

public void handleEventRequest (EventRequest request, EventResponse response)

Process the event request. There is nothing to return.

Parameters
request current portlet event request
response current portlet event response
Throws
Exception

public ModelAndView handleResourceRequest (ResourceRequest request, ResourceResponse response)

Process the resource request and return a ModelAndView object which the DispatcherPortlet will render. A null return value is not an error: It indicates that this object completed request processing itself, thus there is no ModelAndView to render.

Parameters
request current portlet resource request
response current portlet resource response
Returns
  • a ModelAndView to render, or null if handled directly
Throws
Exception

public void setBeanName (String name)

Set the name of the bean in the bean factory that created this bean.

Invoked after population of normal bean properties but before an init callback such as afterPropertiesSet() or a custom init-method.

Parameters
name the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use the BeanFactoryUtils#originalBeanName(String) method to extract the original bean name (without suffix), if desired.

public void setInitParameters (Map<StringString> initParameters)

Specify init parameters for the portlet to wrap, as name-value pairs.

public void setPortletClass (Class portletClass)

Set the class of the Portlet to wrap. Needs to implement javax.portlet.Portlet.

See Also
  • javax.portlet.Portlet

public void setPortletConfig (PortletConfig portletConfig)

Set the PortletConfigthat this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.

Parameters
portletConfig PortletConfig object to be used by this object

public void setPortletContext (PortletContext portletContext)

Set the PortletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.

Parameters
portletContext PortletContext object to be used by this object

public void setPortletName (String portletName)

Set the name of the Portlet to wrap. Default is the bean name of this controller.

public void setUseSharedPortletConfig (boolean useSharedPortletConfig)

Set whether to use the shared PortletConfig object passed in through setPortletConfig, if available.

Default is "true". Turn this setting to "false" to pass in a mock PortletConfig object with the bean name as portlet name, holding the current PortletContext.

Protected Methods

protected void handleActionRequestInternal (ActionRequest request, ActionResponse response)

Subclasses are meant to override this method if the controller is expected to handle action requests. The contract is the same as for handleActionRequest.

The default implementation throws a PortletException.

Throws
Exception

protected ModelAndView handleRenderRequestInternal (RenderRequest request, RenderResponse response)

Subclasses are meant to override this method if the controller is expected to handle render requests. The contract is the same as for handleRenderRequest.

The default implementation throws a PortletException.

Throws
Exception