I have a none standard Spring MVC project. Responding with XMLs. Is it possible to create a view (jsp page) showing all controllers, mappings and parameters that are accepted (required and not).
Based on answer,I have:
@RequestMapping(value= "/endpoints", params="secure", method = RequestMethod.GET)
public @ResponseBody
String getEndPointsInView() {
String result = "";
for (RequestMappingInfo element : requestMappingHandlerMapping.getHandlerMethods().keySet()) {
result += "<p>" + element.getPatternsCondition() + "<br>";
result += element.getMethodsCondition() + "<br>";
result += element.getParamsCondition() + "<br>";
result += element.getConsumesCondition() + "<br>";
}
return result;
}
I don't get any information from @RequestParam
With
RequestMappingHandlerMapping
in Spring 3.1, you can easily browse the endpoints.The controller :
The view :
You can also do this with Spring < 3.1, with
DefaultAnnotationHandlerMapping
instead ofRequestMappingHandlerMapping
. But you won't have the same level of information.With
DefaultAnnotationHandlerMapping
you will only have the endpoints path, without information about their methods, consumes, params...