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

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

    java.lang.Object
      org.springframework.web.portlet.handler.HandlerInterceptorAdapter
          org.springframework.web.portlet.handler.ParameterMappingInterceptor

All Implemented Interfaces:
  HandlerInterceptor

    public class ParameterMappingInterceptor

extends HandlerInterceptorAdapter

Interceptor to forward a request parameter from the `ActionRequest` to the `RenderRequest`.

This can be useful when using `ParameterHandlerMapping` or `PortletModeParameterHandlerMapping`. It will ensure that the parameter that was used to map the `ActionRequest` to a handler will be forwarded to the `RenderRequest` so that it will also be mapped the same way.

When using this Interceptor, you can still change the value of the mapping parameter in your handler in order to change where the render request will get mapped.

Be aware that this Interceptor does call `ActionResponse.setRenderParameter`, which means that you will not be able to call `ActionResponse.sendRedirect` in your handler. If you may need to issue a redirect, then you should avoid this Interceptor and either write a different one that does this in a different way, or manually forward the parameter from within your handler(s).

Thanks to Rainer Schmitz for suggesting this mapping strategy!

Since:
  2.0
Author:
  John A. Lewis
See Also:
  `ParameterHandlerMapping`, `PortletModeParameterHandlerMapping`

Field Summary
`static String` | `DEFAULT_PARAMETER_NAME` Request parameter name to use for mapping to handlers

Constructor Summary
`ParameterMappingInterceptor()`

Method Summary
`boolean` | `preHandleAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, Object handler)` If request is an `ActionRequest`, get handler mapping parameter and add it to the ActionResponse.
`void` | `setParameterName(String parameterName)` Set the name of the parameter used for mapping.

Methods inherited from class org.springframework.web.portlet.handler.HandlerInterceptorAdapter
`afterActionCompletion, afterCompletion, afterRenderCompletion, postHandleRender, preHandle, preHandleRender`

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

Field Detail

### DEFAULT_PARAMETER_NAME

    public static final String DEFAULT_PARAMETER_NAME

  Request parameter name to use for mapping to handlers

  See Also:
    Constant Field Values

Constructor Detail

### ParameterMappingInterceptor

    public ParameterMappingInterceptor()

Method Detail

### setParameterName

    public void setParameterName(String parameterName)

  Set the name of the parameter used for mapping.

### preHandleAction

    public boolean preHandleAction(javax.portlet.ActionRequest request,
                                   javax.portlet.ActionResponse response,
                                   Object handler)

  If request is an `ActionRequest`, get handler mapping parameter and add it to the ActionResponse.

  Specified by:
    `preHandleAction` in interface `HandlerInterceptor`
  Overrides:
    `preHandleAction` in class `HandlerInterceptorAdapter`
  Parameters:
    `request` - current portlet action request
    `response` - current portlet action response
    `handler` - chosen handler to execute, for type and/or instance evaluation
  Returns:
    `true` if the execution chain should proceed with the next interceptor or the handler itself. Else, `DispatcherPortlet` assumes that this interceptor has already dealt with the response itself
  See Also:
    `HandlerInterceptorAdapter.preHandle(javax.portlet.PortletRequest, javax.portlet.PortletResponse, java.lang.Object)`

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

Copyright © 2002-2008 The Spring Framework.