HandlerInterceptor improvement - insufficient context (no handler method) information [SPR-7408] #12066
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
sandstorm opened SPR-7408 and commented
When implementing
@Controllers
, one may have multiple handling methods, as opposed to the old fashion Controller-interface style-based ones.The problem is that when implementing HandlerInterceptors one may not infer the handling method being invoked. For example if one wants to check if the current handling method being invoked has been annotated, thats impossible, and is 'of importance'.
Consider this method signature:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Currently the handler parameter represents the controller class and not any particular handling method.
The actual proposal is this Object to be of class java.lang.Method if the class implementing that is annotated with
@Controller
, instead of implementing the Controller interface, otherwise it may retain the current semantics for compatibility reasons.It is expected that in the case being discussed the Object handler parameter currently provides no benefit, and is of no use to anybody implementing a
@Controller
, therefore it is expected not to introduce any backwards compatibility issues thereof.Several workarounds have been researched but this solution remains of particular neatness and simplicity.
The solution implementation is estimated to be simple, and cheap in terms of time, so please, Spring fellows, do something.
Thank you.
2 votes, 5 watchers
The text was updated successfully, but these errors were encountered: