public class PortletWrappingController extends AbstractController implements ResourceAwareController, EventAwareController, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, PortletContextAware, PortletConfigAware
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>| Constructor and Description |
|---|
PortletWrappingController() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
protected void |
handleActionRequestInternal(ActionRequest request,
ActionResponse response)
Subclasses are meant to override this method if the controller
is expected to handle action requests.
|
void |
handleEventRequest(EventRequest request,
EventResponse response)
Process the event request.
|
protected ModelAndView |
handleRenderRequestInternal(RenderRequest request,
RenderResponse response)
Subclasses are meant to override this method if the controller
is expected to handle render requests.
|
ModelAndView |
handleResourceRequest(ResourceRequest request,
ResourceResponse response)
Process the resource request and return a ModelAndView object which the DispatcherPortlet
will render.
|
void |
setBeanName(String name) |
void |
setInitParameters(Map<String,String> 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. |
handleActionRequest, handleRenderRequest, isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSessionapplyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSessiongetPortletContext, getTempDir, isContextRequiredpublic void setUseSharedPortletConfig(boolean useSharedPortletConfig)
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.
public void setPortletContext(PortletContext portletContext)
PortletContextAwareInvoked 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.
setPortletContext in interface PortletContextAwaresetPortletContext in class PortletApplicationObjectSupportportletContext - PortletContext object to be used by this objectpublic void setPortletConfig(PortletConfig portletConfig)
PortletConfigAwareInvoked 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.
setPortletConfig in interface PortletConfigAwareportletConfig - PortletConfig object to be used by this objectpublic void setPortletClass(Class<?> portletClass)
javax.portlet.Portlet.Portletpublic void setPortletName(String portletName)
public void setInitParameters(Map<String,String> initParameters)
public void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionprotected void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception
AbstractControllerhandleActionRequest.
The default implementation throws a PortletException.
protected ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception
AbstractControllerhandleRenderRequest.
The default implementation throws a PortletException.
public ModelAndView handleResourceRequest(ResourceRequest request, ResourceResponse response) throws Exception
ResourceAwareControllernull return value is not an error: It indicates that this
object completed request processing itself, thus there is no ModelAndView to render.handleResourceRequest in interface ResourceAwareControllerrequest - current portlet resource requestresponse - current portlet resource responseException - in case of errorspublic void handleEventRequest(EventRequest request, EventResponse response) throws Exception
EventAwareControllerhandleEventRequest in interface EventAwareControllerrequest - current portlet event requestresponse - current portlet event responseException - in case of errorspublic void destroy()
destroy in interface org.springframework.beans.factory.DisposableBean