Interface HandlerMethodInterceptor
-
- All Known Implementing Classes:
WebEventPublisher
public interface HandlerMethodInterceptor
HandlerMethod
Interceptor that allows for customizedHandlerMethod
execution chains. Applications can register any number of existing or custom interceptors for certain groups of handlers, to add common preprocessing behavior without needing to modify each handler implementation.A HandlerInterceptor gets called before the appropriate HandlerAdapter triggers the execution of the handler itself.
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
HandlerMethod
,org.springframework.web.servlet.DispatcherServlet
,org.springframework.web.reactive.DispatcherHandler
,org.springframework.web.servlet.HandlerMapping
,org.springframework.web.reactive.HandlerMapping
,org.springframework.web.servlet.HandlerAdapter
,org.springframework.web.reactive.HandlerAdapter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
afterExecute(org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Object[] args, java.lang.Object returnValue, java.lang.Throwable error, org.springframework.web.context.request.NativeWebRequest request)
Interception point after successful execution of aHandlerMethod
.void
beforeExecute(org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Object[] args, org.springframework.web.context.request.NativeWebRequest request)
Interception point before the execution of aHandlerMethod
.
-
-
-
Method Detail
-
beforeExecute
void beforeExecute(org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Object[] args, org.springframework.web.context.request.NativeWebRequest request) throws java.lang.Exception
Interception point before the execution of aHandlerMethod
. Called after HandlerMapping determined an appropriate handler object, but before HandlerAdapter invokes the handler.- Parameters:
handlerMethod
-HandlerMethod
args
- the resolved arguments ofHandlerMethod
request
-WebRequest
- Throws:
java.lang.Exception
- if any error caused
-
afterExecute
void afterExecute(org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Object[] args, @Nullable java.lang.Object returnValue, @Nullable java.lang.Throwable error, org.springframework.web.context.request.NativeWebRequest request) throws java.lang.Exception
Interception point after successful execution of aHandlerMethod
. Called after HandlerAdapter actually invoked the handler.- Parameters:
handlerMethod
-HandlerMethod
args
- the resolved arguments ofHandlerMethod
returnValue
- the return value ofHandlerMethod
error
- the error afterHandlerMethod
invocationrequest
-WebRequest
- Throws:
java.lang.Exception
- if any error caused
-
-