3

I have an application which exposes RESTful actions using spring annotations and Spring MVC.

It looks like

@RequestMapping(value = "/example/{someId}", 
    method = RequestMethod.GET, consumes=MediaType.APPLICATION_JSON_VALUE, 
    produces=MediaType.APPLICATION_JSON_VALUE)
@ResponseBody 
public void isRegisteredToThread(@PathVariable long someId, HttpServletResponse response) {

    [something]
}

What I want is an automatically generated listing of all URL's, methods and available parameters - possibly within a WSDL. Is there a plugin or is it somehwere available?

Charles
  • 50,943
  • 13
  • 104
  • 142
Chris
  • 8,031
  • 10
  • 41
  • 67
  • 2
    Take a look at [this answer](http://stackoverflow.com/a/9767985/750510). I think it may be helpful for you. – madhead Mar 23 '13 at 01:19

2 Answers2

0

WSDL is not done for rest, it's used for SOAP.

You might use WADL, but I really do not suggest it.

In my project I always use swagger (there is a release for spring). You may find more info here https://github.com/martypitt/swagger-springmvc and here http://blog.zenika.com/index.php?post/2013/07/11/Documenting-a-REST-API-with-Swagger-and-Spring-MVC

Give it a try.

As an alternative, if you don't need something web-based, you may try rest-shell (https://github.com/spring-projects/rest-shell)

Pirulino
  • 758
  • 1
  • 9
  • 20
0

You could take a look at the source code of RequestMappingEndpoint provided by the Spring Boot and see how Spring Boot reports the mappings.

Looking through that code one can see that the mappings (both handler and method mappings) can easily be obtained from the applicationContext

(using

applicationContext.getBeansOfType(AbstractUrlHandlerMapping.class)

and

applicationContext.getBeansOfType(AbstractHandlerMethodMapping.class)

respectively). After you have obtained the mapping you can process them anyway you like. You might want to create a library that could include in all your projects that processes the mapping your organizations desired form

geoand
  • 60,071
  • 24
  • 172
  • 190