Interface HandlerMethodInterceptor
- All Known Implementing Classes:
WebEventPublisher
public interface HandlerMethodInterceptor
HandlerMethod Interceptor that allows for customized HandlerMethod 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:
-
HandlerMethodorg.springframework.web.servlet.DispatcherServletorg.springframework.web.reactive.DispatcherHandlerorg.springframework.web.servlet.HandlerMappingorg.springframework.web.reactive.HandlerMappingorg.springframework.web.servlet.HandlerAdapterorg.springframework.web.reactive.HandlerAdapter
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterExecute(org.springframework.web.method.HandlerMethod handlerMethod, Object[] args, Object returnValue, Throwable error, org.springframework.web.context.request.NativeWebRequest request) Interception point after successful execution of aHandlerMethod.default voidbeforeExecute(org.springframework.web.method.HandlerMethod handlerMethod, Object[] args, org.springframework.web.context.request.NativeWebRequest request) Interception point before the execution of aHandlerMethod.
-
Method Details
-
beforeExecute
default void beforeExecute(org.springframework.web.method.HandlerMethod handlerMethod, Object[] args, org.springframework.web.context.request.NativeWebRequest request) throws Exception Interception point before the execution of aHandlerMethod. Called after HandlerMapping determined an appropriate handler object, but before HandlerAdapter invokes the handler.- Parameters:
handlerMethod-HandlerMethodargs- the resolved arguments ofHandlerMethodrequest-WebRequest- Throws:
Exception- if any error caused
-
afterExecute
default void afterExecute(org.springframework.web.method.HandlerMethod handlerMethod, Object[] args, @Nullable Object returnValue, @Nullable Throwable error, org.springframework.web.context.request.NativeWebRequest request) throws Exception Interception point after successful execution of aHandlerMethod. Called after HandlerAdapter actually invoked the handler.- Parameters:
handlerMethod-HandlerMethodargs- the resolved arguments ofHandlerMethodreturnValue- the return value ofHandlerMethoderror- the error afterHandlerMethodinvocationrequest-WebRequest- Throws:
Exception- if any error caused
-