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 java.lang.Object implements org.springframework.web.servlet.HandlerInterceptor
HandlerMethod
HandlerInterceptor
abstract implementation- Since:
- 1.0.0
- Author:
- Mercy
-
-
Constructor Summary
Constructors Constructor Description MethodHandlerInterceptor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)
protected abstract void
afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Exception ex)
protected java.lang.Object[]
getHandlerMethodArguments(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets theHandlerMethod
method parameterprotected <T> T
getHandlerMethodRequestBodyArgument(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets the@RequestBody
method parameter from theServletRequest
contextprotected <T> T
getHandlerMethodReturnValue(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets the value returned by theHandlerMethod
methodvoid
postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, org.springframework.web.servlet.ModelAndView modelAndView)
protected abstract void
postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.servlet.ModelAndView modelAndView)
boolean
preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)
protected abstract boolean
preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod)
protected boolean
supports(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod)
-
-
-
Method Detail
-
preHandle
public final boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
- Specified by:
preHandle
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Throws:
java.lang.Exception
-
preHandle
protected abstract boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws java.lang.Exception
- Throws:
java.lang.Exception
-
postHandle
public final void postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, @Nullable org.springframework.web.servlet.ModelAndView modelAndView) throws java.lang.Exception
- Specified by:
postHandle
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Throws:
java.lang.Exception
-
postHandle
protected abstract void postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.servlet.ModelAndView modelAndView) throws java.lang.Exception
- Throws:
java.lang.Exception
-
afterCompletion
public final void afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, @Nullable java.lang.Exception ex) throws java.lang.Exception
- Specified by:
afterCompletion
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Throws:
java.lang.Exception
-
afterCompletion
protected abstract void afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Exception ex) throws java.lang.Exception
- Throws:
java.lang.Exception
-
supports
protected boolean supports(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getHandlerMethodArguments
protected java.lang.Object[] getHandlerMethodArguments(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets theHandlerMethod
method parameter- Parameters:
request
-ServletRequest
handlerMethod
-HandlerMethod
- Returns:
- non-null
-
getHandlerMethodReturnValue
protected <T> T getHandlerMethodReturnValue(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets the value returned by theHandlerMethod
method- Type Parameters:
T
- Method return value type- Parameters:
request
-ServletRequest
handlerMethod
-HandlerMethod
- Returns:
HandlerMethod
Method return value
-
getHandlerMethodRequestBodyArgument
protected <T> T getHandlerMethodRequestBodyArgument(javax.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Gets the@RequestBody
method parameter from theServletRequest
context- Type Parameters:
T
-@RequestBody
Method parameter Types- Parameters:
request
-ServletRequest
handlerMethod
-HandlerMethod
- Returns:
@RequestBody
Method argument if present, otherwisenull
-
-