Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

U can use eclipse to search the path or action specified. Mostly all the actions are mapped to the respective controller. For Ex: any action related to the search are mapped to the SearchPageController.java and any action related to Product will be mapped to ProductPageController.java. Hope this helps...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top