1
|
package eu.dnetlib;
|
2
|
|
3
|
import java.util.List;
|
4
|
import java.util.Map.Entry;
|
5
|
import java.util.Set;
|
6
|
|
7
|
import com.google.common.collect.Sets;
|
8
|
import org.apache.commons.logging.Log;
|
9
|
import org.apache.commons.logging.LogFactory;
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
11
|
import org.springframework.web.bind.annotation.RequestMapping;
|
12
|
import org.springframework.web.bind.annotation.RequestMethod;
|
13
|
import org.springframework.web.bind.annotation.RestController;
|
14
|
import org.springframework.web.method.HandlerMethod;
|
15
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
16
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
17
|
|
18
|
/**
|
19
|
* Created by claudio on 30/11/2016.
|
20
|
*/
|
21
|
@RestController
|
22
|
public class EndpointDocController {
|
23
|
|
24
|
private static final Log log = LogFactory.getLog(EndpointDocController.class);
|
25
|
|
26
|
@Autowired
|
27
|
private List<RequestMappingHandlerMapping> handlerMappings;
|
28
|
|
29
|
@RequestMapping(value = "/endpointdoc", method = RequestMethod.GET)
|
30
|
public Set<String> show() {
|
31
|
|
32
|
final Set<String> res = Sets.newHashSet();
|
33
|
for(RequestMappingHandlerMapping handler : handlerMappings) {
|
34
|
|
35
|
for(Entry<RequestMappingInfo, HandlerMethod> e : handler.getHandlerMethods().entrySet()) {
|
36
|
final RequestMappingInfo info = e.getKey();
|
37
|
res.add(info.toString());
|
38
|
}
|
39
|
}
|
40
|
return res;
|
41
|
}
|
42
|
|
43
|
}
|