Class MethodHandlerInterceptor

java.lang.Object
io.microsphere.spring.webmvc.interceptor.MethodHandlerInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor
Direct Known Subclasses:
AnnotatedMethodHandlerInterceptor

public abstract class MethodHandlerInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
HandlerMethod HandlerInterceptor abstract implementation
Since:
1.0.0
Author:
Mercy
  • Constructor Summary

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex)
     
    protected abstract void
    afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, Exception ex)
     
    protected Object[]
    getHandlerMethodArguments(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
    Gets the HandlerMethod method parameter
    protected <T> T
    getHandlerMethodRequestBodyArgument(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
    Gets the @RequestBody method parameter from the ServletRequest context
    protected <T> T
    getHandlerMethodReturnValue(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
    Gets the value returned by the HandlerMethod method
    final void
    postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)
     
    protected abstract void
    postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.servlet.ModelAndView modelAndView)
     
    final boolean
    preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
     
    protected abstract boolean
    preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod)
     
    protected boolean
    supports(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MethodHandlerInterceptor

      public MethodHandlerInterceptor()
  • Method Details

    • preHandle

      public final boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) throws Exception
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • preHandle

      protected abstract boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws Exception
      Throws:
      Exception
    • postHandle

      public final void postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, @Nullable org.springframework.web.servlet.ModelAndView modelAndView) throws Exception
      Specified by:
      postHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • postHandle

      protected abstract void postHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception
      Throws:
      Exception
    • afterCompletion

      public final void afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception
      Specified by:
      afterCompletion in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • afterCompletion

      protected abstract void afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, Exception ex) throws Exception
      Throws:
      Exception
    • supports

      protected boolean supports(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws Exception
      Throws:
      Exception
    • getHandlerMethodArguments

      protected Object[] getHandlerMethodArguments(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
      Gets the HandlerMethod method parameter
      Parameters:
      request - ServletRequest
      handlerMethod - HandlerMethod
      Returns:
      non-null
    • getHandlerMethodReturnValue

      protected <T> T getHandlerMethodReturnValue(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
      Gets the value returned by the HandlerMethod method
      Type Parameters:
      T - Method return value type
      Parameters:
      request - ServletRequest
      handlerMethod - HandlerMethod
      Returns:
      HandlerMethod Method return value
    • getHandlerMethodRequestBodyArgument

      protected <T> T getHandlerMethodRequestBodyArgument(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
      Gets the @RequestBody method parameter from the ServletRequest context
      Type Parameters:
      T - @RequestBody Method parameter Types
      Parameters:
      request - ServletRequest
      handlerMethod - HandlerMethod
      Returns:
      @RequestBody Method argument if present, otherwise null