org.springframework.web.servlet.handler

## Class HandlerInterceptorAdapter

- java.lang.Object
- - org.springframework.web.servlet.handler.HandlerInterceptorAdapter

- All Implemented Interfaces:
    AsyncHandlerInterceptor, HandlerInterceptor
  Direct Known Subclasses:
    ConversionServiceExposingInterceptor, LocaleChangeInterceptor, ThemeChangeInterceptor, UserRoleAuthorizationInterceptor

      public abstract class HandlerInterceptorAdapter
      extends Object
      implements AsyncHandlerInterceptor

  Abstract adapter class for the HandlerInterceptor interface, for simplified implementation of pre-only/post-only interceptors.
  Since:
    05.12.2003
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HandlerInterceptorAdapter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)` This implementation is empty.
    `void` | `afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler)` This implementation is empty.
    `void` | `postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)` This implementation is empty.
    `boolean` | `preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)` This implementation always returns `true`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HandlerInterceptorAdapter

          public HandlerInterceptorAdapter()

  - ### Method Detail

    - #### preHandle

          public boolean preHandle(HttpServletRequest request,
                          HttpServletResponse response,
                          Object handler)
                            throws Exception

      This implementation always returns `true`.
      Specified by:
        `preHandle` in interface `HandlerInterceptor`
      Parameters:
        `request` - current HTTP request
        `response` - current HTTP 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, DispatcherServlet assumes that this interceptor has already dealt with the response itself.
      Throws:
        `Exception` - in case of errors

    - #### postHandle

          public void postHandle(HttpServletRequest request,
                        HttpServletResponse response,
                        Object handler,
                        ModelAndView modelAndView)
                          throws Exception

      This implementation is empty.
      Specified by:
        `postHandle` in interface `HandlerInterceptor`
      Parameters:
        `request` - current HTTP request
        `response` - current HTTP response
        `handler` - handler (or `HandlerMethod`) that started async execution, for type and/or instance examination
        `modelAndView` - the `ModelAndView` that the handler returned (can also be `null`)
      Throws:
        `Exception` - in case of errors

    - #### afterCompletion

          public void afterCompletion(HttpServletRequest request,
                             HttpServletResponse response,
                             Object handler,
                             Exception ex)
                               throws Exception

      This implementation is empty.
      Specified by:
        `afterCompletion` in interface `HandlerInterceptor`
      Parameters:
        `request` - current HTTP request
        `response` - current HTTP response
        `handler` - handler (or `HandlerMethod`) that started async execution, for type and/or instance examination
        `ex` - exception thrown on handler execution, if any
      Throws:
        `Exception` - in case of errors

    - #### afterConcurrentHandlingStarted

          public void afterConcurrentHandlingStarted(HttpServletRequest request,
                                            HttpServletResponse response,
                                            Object handler)
                                              throws Exception

      This implementation is empty.
      Specified by:
        `afterConcurrentHandlingStarted` in interface `AsyncHandlerInterceptor`
      Parameters:
        `request` - the current request
        `response` - the current response
        `handler` - handler (or `HandlerMethod`) that started async execution, for type and/or instance examination
      Throws:
        `Exception` - in case of errors