This commit is contained in:
Redkale
2016-09-06 13:45:56 +08:00
parent fa8e40f6c0
commit 1f0e0accb1
2 changed files with 9 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ public class RestDocs extends HttpBaseServlet {
serverList.add(map);
HttpServer server = node.getServer();
map.put("address", server.getSocketAddress());
List<Map> servletsList = new ArrayList<>();
List<Map<String, Object>> servletsList = new ArrayList<>();
map.put("servlets", servletsList);
for (HttpServlet servlet : server.getPrepareServlet().getServlets()) {
if (!(servlet instanceof HttpServlet)) continue;
@@ -109,8 +109,14 @@ public class RestDocs extends HttpBaseServlet {
}
actionsList.add(actionmap);
}
actionsList.sort((o1, o2) -> ((String) o1.get("url")).compareTo((String) o2.get("url")));
servletsList.add(servletmap);
}
servletsList.sort((o1, o2) -> {
String[] mappings1 = (String[]) o1.get("mappings");
String[] mappings2 = (String[]) o2.get("mappings");
return mappings1.length > 0 ? (mappings2.length > 0 ? mappings1[0].compareTo(mappings2[0]) : 1) : -1;
});
}
Map<String, Object> resultmap = new LinkedHashMap<>();
resultmap.put("servers", serverList);

View File

@@ -303,6 +303,7 @@ public final class Rest {
String url = "/" + defmodulename.toLowerCase() + "/" + entry.name + (reqpath ? "/" : "");
av0.visit("url", url);
av0.visit("actionid", entry.actionid);
av0.visit("comment", entry.comment);
AnnotationVisitor av1 = av0.visitArray("methods");
for (String m : entry.methods) {
@@ -330,6 +331,7 @@ public final class Rest {
av0.visitEnd();
actionMap.put("url", url);
actionMap.put("actionid", entry.actionid);
actionMap.put("comment", entry.comment);
actionMap.put("methods", entry.methods);
}