Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.portlet.handler
Class SimplePortletHandlerAdapter

    java.lang.Object
      org.springframework.web.portlet.handler.SimplePortletHandlerAdapter

All Implemented Interfaces:
  Aware, PortletContextAware, HandlerAdapter

    public class SimplePortletHandlerAdapter

extends java.lang.Object
implements HandlerAdapter, PortletContextAware

Adapter to use the Portlet interface with the generic DispatcherPortlet. Calls the Portlet's `render` and `processAction` methods to handle a request.

This adapter is not activated by default; it needs to be defined as a bean in the DispatcherPortlet context. It will automatically apply to mapped handler beans that implement the Portlet interface then.

Note that Portlet instances defined as bean will not receive initialization and destruction callbacks, unless a special post-processor such as SimplePortletPostProcessor is defined in the DispatcherPortlet context.

Alternatively, consider wrapping a Portlet with Spring's PortletWrappingController. This is particularly appropriate for existing Portlet classes, allowing to specify Portlet initialization parameters, etc.

Since:
  2.0
Author:
  John A. Lewis
See Also:
  `Portlet`, `SimplePortletPostProcessor`, `PortletWrappingController`

Constructor Summary
`SimplePortletHandlerAdapter()`

Method Summary
`void` | `handleAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, java.lang.Object handler)` Use the given handler to handle this action request.
`void` | `handleEvent(javax.portlet.EventRequest request, javax.portlet.EventResponse response, java.lang.Object handler)` Use the given handler to handle this event request.
`ModelAndView` | `handleRender(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, java.lang.Object handler)` Use the given handler to handle this render request.
`ModelAndView` | `handleResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response, java.lang.Object handler)` Use the given handler to handle this resource request.
`void` | `setPortletContext(javax.portlet.PortletContext portletContext)` Set the PortletContext that this object runs in.
`boolean` | `supports(java.lang.Object handler)` Given a handler instance, return whether or not this HandlerAdapter can support it.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimplePortletHandlerAdapter

    public SimplePortletHandlerAdapter()

Method Detail

### setPortletContext

    public void setPortletContext(javax.portlet.PortletContext portletContext)

  Description copied from interface: `PortletContextAware`
  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.

  Specified by:
    `setPortletContext` in interface `PortletContextAware`
  Parameters:
    `portletContext` - PortletContext object to be used by this object

### supports

    public boolean supports(java.lang.Object handler)

  Description copied from interface: `HandlerAdapter`
  Given a handler instance, return whether or not this HandlerAdapter can support it. Typical HandlerAdapters will base the decision on the handler type. HandlerAdapters will usually only support one handler type each.

  A typical implementation:

  `return (handler instanceof MyHandler);`

  Specified by:
    `supports` in interface `HandlerAdapter`
  Parameters:
    `handler` - handler object to check
  Returns:
    whether or not this object can use the given handler

### handleAction

    public void handleAction(javax.portlet.ActionRequest request,
                             javax.portlet.ActionResponse response,
                             java.lang.Object handler)
                      throws java.lang.Exception

  Description copied from interface: `HandlerAdapter`
  Use the given handler to handle this action request. The workflow that is required may vary widely.

  Specified by:
    `handleAction` in interface `HandlerAdapter`
  Parameters:
    `request` - current action request
    `response` - current action response
    `handler` - handler to use. This object must have previously been passed to the `supports` method of this interface, which must have returned true.
  Throws:
    `java.lang.Exception` - in case of errors
  See Also:
    `Portlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)`

### handleRender

    public ModelAndView handleRender(javax.portlet.RenderRequest request,
                                     javax.portlet.RenderResponse response,
                                     java.lang.Object handler)
                              throws java.lang.Exception

  Description copied from interface: `HandlerAdapter`
  Use the given handler to handle this render request. The workflow that is required may vary widely.

  Specified by:
    `handleRender` in interface `HandlerAdapter`
  Parameters:
    `request` - current render request
    `response` - current render response
    `handler` - handler to use. This object must have previously been passed to the `supports` method of this interface, which must have returned `true`.
  Returns:
    ModelAndView object with the name of the view and the required model data, or `null` if the request has been handled directly
  Throws:
    `java.lang.Exception` - in case of errors
  See Also:
    `Portlet.render(javax.portlet.RenderRequest, javax.portlet.RenderResponse)`

### handleResource

    public ModelAndView handleResource(javax.portlet.ResourceRequest request,
                                       javax.portlet.ResourceResponse response,
                                       java.lang.Object handler)
                                throws java.lang.Exception

  Description copied from interface: `HandlerAdapter`
  Use the given handler to handle this resource request. The workflow that is required may vary widely.

  Specified by:
    `handleResource` in interface `HandlerAdapter`
  Parameters:
    `request` - current render request
    `response` - current render response
    `handler` - handler to use. This object must have previously been passed to the `supports` method of this interface, which must have returned `true`.
  Returns:
    ModelAndView object with the name of the view and the required model data, or `null` if the request has been handled directly
  Throws:
    `java.lang.Exception` - in case of errors
  See Also:
    `ResourceServingPortlet.serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)`

### handleEvent

    public void handleEvent(javax.portlet.EventRequest request,
                            javax.portlet.EventResponse response,
                            java.lang.Object handler)
                     throws java.lang.Exception

  Description copied from interface: `HandlerAdapter`
  Use the given handler to handle this event request. The workflow that is required may vary widely.

  Specified by:
    `handleEvent` in interface `HandlerAdapter`
  Parameters:
    `request` - current action request
    `response` - current action response
    `handler` - handler to use. This object must have previously been passed to the `supports` method of this interface, which must have returned true.
  Throws:
    `java.lang.Exception` - in case of errors
  See Also:
    `EventPortlet.processEvent(javax.portlet.EventRequest, javax.portlet.EventResponse)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD