list.jsp 4.1 KB
<%@page import="com.diligrp.mobsite.getway.web.api.base.CommonController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.base.version.DeviceInfoController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.base.version.VersionController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.goods.GoodsController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.home.MarketController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.home.TopicController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.priceIndex.PriceIndexController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.service.ServiceController" %>
<%@page import="com.diligrp.mobsite.getway.web.api.buyer.settle.CartController" %>
<%@ page import="com.diligrp.mobsite.getway.web.api.buyer.settle.ConsigneeController" %>
<%@ page import="com.diligrp.mobsite.getway.web.api.buyer.shop.ShopController" %>
<%@ page import="com.diligrp.mobsite.getway.web.api.buyer.user.CareCategoryController" %>
<%@ page import="com.diligrp.mobsite.getway.web.api.buyer.user.OrderController" %>
<%@ page import="com.diligrp.mobsite.getway.web.api.buyer.user.UserController" %>
<%@ page import="com.diligrp.mobsite.getway.web.utils.DiligrpEndpoint" %>
<%@ page import="org.springframework.web.bind.annotation.RequestMapping" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page import="java.util.Arrays" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
</head>
<body>
<center><h2>The list of endpoint</h2></center>
<table width="80%" border="1" cellpadding="5" cellspacing="0">
    <tr>
        <th>Index</th>
        <th>Endpoint</th>
        <th>Request</th>
        <th>Response</th>
        <th>Description</th>
        <th>javadoc</th>
    </tr>
    <%
        String link = "http://10.28.6.104:8002/api-doc/";
        Class[] apiClass = new Class[]{ShopController.class, CommonController.class,
                VersionController.class, GoodsController.class, MarketController.class,
                TopicController.class, DeviceInfoController.class,
                CartController.class, ConsigneeController.class, UserController.class,
                CareCategoryController.class, OrderController.class,
                PriceIndexController.class};
        int index = 1;
        for (Class item : apiClass) {
            Method[] methods = item.getDeclaredMethods();
            RequestMapping rm = (RequestMapping) item.getAnnotation(RequestMapping.class);
            if (rm == null) {
                continue;
            }
            String prefix = Arrays.toString(rm.value());
            prefix = prefix.substring(1, prefix.length() - 1);
            for (Method m : methods) {

                if (m.getAnnotation(Deprecated.class) != null) {
                    continue;
                }
                rm = m.getAnnotation(RequestMapping.class);
                if (rm == null) {
                    continue;
                }
                DiligrpEndpoint endpoint = m.getAnnotation(DiligrpEndpoint.class);
                String url = Arrays.toString(rm.value());
                url = url.substring(1, url.length() - 1);
    %>
    <tr>
        <td><%=index++%>
        </td>
        <td><%=prefix.endsWith("/") ? prefix : prefix + "/" %><%=url.startsWith("/") ? url.substring(1) : url %>.do</td>
        <td><%=endpoint == null ? "" : endpoint.req() == null ? "" : endpoint.req().getSimpleName()%>
        </td>
        <td><%=endpoint == null ? "" : endpoint.resp() == null ? "" : endpoint.resp().getSimpleName()%>
        </td>
        <td><%=endpoint == null ? "" : endpoint.desc()%>
        </td>
        <td><a href="<%=link+item.getCanonicalName().replaceAll("\\.", "/")+".html#"+m.getName()+"()"%>"
               target="_blank"><%=m.toGenericString() %>
        </a></td>
        <%
            }
        %></tr>
    <%
        }
    %>
</table>
</body>
</html>