When implementing interceptor with Servlet API I got HandlerMethod
out of the box:
... extends HandlerInterceptorAdapter
@Override
public boolean preHandle(final HttpServletRequest request,
final HttpServletResponse response, final Object handlerMethod) throws Exception {
Can I get access to HandlerMethod
while implementing WebFilter
instead of HandlerInterceptorAdapter
?
In case of WebFilter
I have:
... implements WebFilter {
public Mono<Void> filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) {
Once I could access HandlerMethod
by invoking serverWebExchange.getAttribute("....bestMatchingHandler")
, but it doesn't work anymore. See corresponding question. My question here is: how can I get HandlerMethod
without using serverWebExchange.getAttribute
?