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 TypeMethodDescriptionfinal 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 theHandlerMethod
method parameterprotected <T> T
getHandlerMethodRequestBodyArgument
(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod) Gets the@RequestBody
method parameter from theServletRequest
contextprotected <T> T
getHandlerMethodReturnValue
(jakarta.servlet.ServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod) Gets the value returned by theHandlerMethod
methodfinal 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)
-
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 interfaceorg.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 interfaceorg.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 interfaceorg.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 theHandlerMethod
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 theHandlerMethod
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 theServletRequest
context- Type Parameters:
T
-@RequestBody
Method parameter Types- Parameters:
request
-ServletRequest
handlerMethod
-HandlerMethod
- Returns:
@RequestBody
Method argument if present, otherwisenull
-