1
|
package eu.dnetlib;
|
2
|
|
3
|
import java.util.List;
|
4
|
import java.util.Set;
|
5
|
import java.util.stream.Collectors;
|
6
|
import java.util.stream.Stream;
|
7
|
|
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.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
15
|
|
16
|
/**
|
17
|
* Created by claudio on 30/11/2016.
|
18
|
*/
|
19
|
@RestController
|
20
|
public class EndpointDocController {
|
21
|
|
22
|
private static final Log log = LogFactory.getLog(EndpointDocController.class);
|
23
|
|
24
|
@Autowired
|
25
|
private List<RequestMappingHandlerMapping> handlerMappings;
|
26
|
|
27
|
@RequestMapping(value = "/endpointdoc", method = RequestMethod.GET)
|
28
|
public Set<String> show() {
|
29
|
return handlerMappings.stream()
|
30
|
.map(h -> h.getHandlerMethods().entrySet().stream()
|
31
|
.map(m -> m.getKey())
|
32
|
.map(i -> i.toString()))
|
33
|
.reduce(Stream::concat)
|
34
|
.orElseGet(Stream::empty)
|
35
|
.collect(Collectors.toSet());
|
36
|
}
|
37
|
|
38
|
}
|