mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-29 08:05:04 +08:00
no message
This commit is contained in:
@@ -32,6 +32,8 @@ import java.util.Set;
|
|||||||
@WebServlet(name = "APIRouter", urlPatterns = "/api/*", loadOnStartup = 11)
|
@WebServlet(name = "APIRouter", urlPatterns = "/api/*", loadOnStartup = 11)
|
||||||
public class APIRouter extends HttpServlet {
|
public class APIRouter extends HttpServlet {
|
||||||
|
|
||||||
|
public static final String PROJECT_PATH = "WechatTicketSystem/";
|
||||||
|
|
||||||
protected static Gson gson = SQLCore.gson;
|
protected static Gson gson = SQLCore.gson;
|
||||||
private Map<String, API> nodes = new HashMap<>();
|
private Map<String, API> nodes = new HashMap<>();
|
||||||
|
|
||||||
@@ -66,9 +68,9 @@ public class APIRouter extends HttpServlet {
|
|||||||
resp.addHeader("Access-Control-Allow-Origin", "*");
|
resp.addHeader("Access-Control-Allow-Origin", "*");
|
||||||
Object obj = null;
|
Object obj = null;
|
||||||
try {
|
try {
|
||||||
API api = nodes.get(req.getRequestURI());
|
API api = nodes.get(req.getRequestURI().substring(PROJECT_PATH.length()));
|
||||||
if (api == null) {
|
if (api == null) {
|
||||||
obj = req.getRequestURI();
|
resp.sendError(HttpServletResponse.SC_FORBIDDEN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WxSession session = getSession(req);
|
WxSession session = getSession(req);
|
||||||
|
|||||||
Reference in New Issue
Block a user