|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2014 the original author or authors.
|
|
|
|
|
* Copyright 2012-2016 the original author or authors.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -36,6 +36,7 @@ import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
|
|
|
|
|
* {@link Endpoint} to expose Spring MVC mappings.
|
|
|
|
|
*
|
|
|
|
|
* @author Dave Syer
|
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
|
*/
|
|
|
|
|
@ConfigurationProperties(prefix = "endpoints.mappings", ignoreUnknownFields = false)
|
|
|
|
|
public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>>
|
|
|
|
@ -84,20 +85,19 @@ public class RequestMappingEndpoint extends AbstractEndpoint<Map<String, Object>
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
|
protected void extractMethodMappings(ApplicationContext applicationContext,
|
|
|
|
|
Map<String, Object> result) {
|
|
|
|
|
if (applicationContext != null) {
|
|
|
|
|
for (String name : applicationContext
|
|
|
|
|
.getBeansOfType(AbstractHandlerMethodMapping.class).keySet()) {
|
|
|
|
|
for (Entry<String, AbstractHandlerMethodMapping> bean : applicationContext
|
|
|
|
|
.getBeansOfType(AbstractHandlerMethodMapping.class).entrySet()) {
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
Map<?, HandlerMethod> methods = applicationContext
|
|
|
|
|
.getBean(name, AbstractHandlerMethodMapping.class)
|
|
|
|
|
.getHandlerMethods();
|
|
|
|
|
Map<?, HandlerMethod> methods = bean.getValue().getHandlerMethods();
|
|
|
|
|
for (Entry<?, HandlerMethod> method : methods.entrySet()) {
|
|
|
|
|
Map<String, String> map = new LinkedHashMap<String, String>();
|
|
|
|
|
map.put("bean", name);
|
|
|
|
|
map.put("method", method.getValue().toString());
|
|
|
|
|
result.put( method.getKey().toString(), map);
|
|
|
|
|
map.put("bean", bean.getKey());
|
|
|
|
|
map.put("method", method.getValue().toString());
|
|
|
|
|
result.put(method.getKey().toString(), map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|