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
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<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.
|
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
void
|
handleActionRequest(ActionRequest request, ActionResponse response)
Process the action request.
|
void
|
handleActionRequestInternal(ActionRequest request, ActionResponse response)
Subclasses are meant to override this method if the controller
is expected to handle action requests.
|
ModelAndView
|
handleRenderRequest(RenderRequest request, RenderResponse response)
Process the render request and return a ModelAndView object which the DispatcherPortlet
will render.
|
ModelAndView
|
handleRenderRequestInternal(RenderRequest request, RenderResponse response)
Subclasses are meant to override this method if the controller
is expected to handle render requests.
|
final
boolean
|
isRenderWhenMinimized()
Return whether controller will render when portlet is minimized.
|
final
boolean
|
isSynchronizeOnSession()
Return whether controller execution should be synchronized on the session.
|
final
void
|
setRenderWhenMinimized(boolean renderWhenMinimized)
Set if the controller should render an view when the portlet is in
a minimized window.
|
final
void
|
setSynchronizeOnSession(boolean synchronizeOnSession)
Set if controller execution should be synchronized on the session,
to serialize parallel invocations from the same client.
|
|
From class
org.springframework.web.portlet.handler.PortletContentGenerator
final
void
|
applyCacheSeconds(MimeResponse response, int seconds)
Apply the given cache seconds to the render response
|
final
void
|
cacheForSeconds(MimeResponse response, int seconds)
Set portlet response to allow caching for the given number of seconds.
|
final
void
|
check(PortletRequest request, PortletResponse response)
Check and prepare the given request and response according to the settings
of this generator.
|
final
void
|
checkAndPrepare(PortletRequest request, MimeResponse response)
Check and prepare the given request and response according to the settings
of this generator.
|
final
void
|
checkAndPrepare(PortletRequest request, MimeResponse response, int cacheSeconds)
Check and prepare the given request and response according to the settings
of this generator.
|
final
int
|
getCacheSeconds()
Return the number of seconds that content is cached.
|
final
boolean
|
isRequireSession()
Return whether a session is required to handle requests.
|
final
void
|
preventCaching(MimeResponse response)
Prevent the render response from being cached.
|
final
void
|
setCacheSeconds(int seconds)
Cache content for the given number of seconds.
|
final
void
|
setRequireSession(boolean requireSession)
Set whether a session should be required to handle requests.
|
|
From class
org.springframework.web.portlet.context.PortletApplicationObjectSupport
final
PortletContext
|
getPortletContext()
Return the current PortletContext.
|
final
File
|
getTempDir()
Return the temporary directory for the current web application,
as provided by the servlet container.
|
boolean
|
isContextRequired()
Overrides the base class behavior to enforce running in an ApplicationContext.
|
void
|
setPortletContext(PortletContext portletContext)
Set the PortletContext that this object runs in.
|
|
From class
org.springframework.context.support.ApplicationObjectSupport
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
org.springframework.beans.factory.BeanNameAware
abstract
void
|
setBeanName(String name)
Set the name of the bean in the bean factory that created this bean.
|
|
From interface
org.springframework.beans.factory.DisposableBean
abstract
void
|
destroy()
Invoked by a BeanFactory on destruction of a singleton.
|
|
From interface
org.springframework.beans.factory.InitializingBean
abstract
void
|
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
|
From interface
org.springframework.context.ApplicationContextAware
|
From interface
org.springframework.web.portlet.context.PortletConfigAware
abstract
void
|
setPortletConfig(PortletConfig portletConfig)
Set the PortletConfigthat this object runs in.
|
|
From interface
org.springframework.web.portlet.context.PortletContextAware
abstract
void
|
setPortletContext(PortletContext portletContext)
Set the PortletContext that this object runs in.
|
|
From interface
org.springframework.web.portlet.mvc.Controller
abstract
void
|
handleActionRequest(ActionRequest request, ActionResponse response)
Process the action request.
|
abstract
ModelAndView
|
handleRenderRequest(RenderRequest request, RenderResponse response)
Process the render request and return a ModelAndView object which the DispatcherPortlet
will render.
|
|
From interface
org.springframework.web.portlet.mvc.EventAwareController
abstract
void
|
handleEventRequest(EventRequest request, EventResponse response)
Process the event request.
|
|
From interface
org.springframework.web.portlet.mvc.ResourceAwareController
abstract
ModelAndView
|
handleResourceRequest(ResourceRequest request, ResourceResponse response)
Process the resource request and return a ModelAndView object which the DispatcherPortlet
will render.
|
|
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.
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 |
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
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<String, String> 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
.
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.
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.