I'd like to set a breakpoint in a certain Controller to debug it. But with all the Spring XML declaration files and annotations in my hybris application, it's hard to tell which Spring Controller is finally serving a certain HTTP request.
Is there an easy way in hybris to know which Controller serves a certain HTTP request? Maybe some tool where you can enter a URL and it tells you to which Controller the request will resolve. Or maybe refining the logging for a certain Spring class that will log this information?
You can extend the Spring class HandlerInterceptorAdapter to create a new interceptor which will be invoked before the Controller is invoked.
In it's preHandle(HttpServletRequest, HttpServletResponse, Object handler)
method, the handler is the controller wich will serve the request, and therefore you can log the controller's name in your log files. Remember to set the log level accordingly for this class.
You need to add this interceptor to <mvc:interceptors>
in your spring-mvc-config.xml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With