类 ParameterMappingInterceptor

  • 所有已实现的接口:
    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!

    从以下版本开始:
    2.0
    作者:
    John A. Lewis
    另请参阅:
    ParameterHandlerMapping, PortletModeParameterHandlerMapping