mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
1.13.1
This commit is contained in:
@@ -2,7 +2,7 @@ package com.gitee.sop.gateway.controller;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.SopConstants;
|
||||
import com.gitee.sop.gatewaycommon.param.ParamNames;
|
||||
import com.gitee.sop.gatewaycommon.util.MappingUtil;
|
||||
import com.gitee.sop.gatewaycommon.util.RouteUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
@@ -17,9 +17,12 @@ public class RestServlet extends HttpServlet {
|
||||
|
||||
private static final String REST_PATH = "/rest";
|
||||
|
||||
@Value("${zuul.servlet-path}")
|
||||
@Value("${zuul.servlet-path:/zuul}")
|
||||
private String path;
|
||||
|
||||
@Value("${zuul.rest-default-version:1.0}")
|
||||
private String defaultVersion;
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
doPost(request, response);
|
||||
@@ -31,10 +34,10 @@ public class RestServlet extends HttpServlet {
|
||||
int index = url.indexOf(REST_PATH);
|
||||
// 取/rest的后面部分
|
||||
String path = url.substring(index + REST_PATH.length());
|
||||
String method = MappingUtil.buildApiName(path);
|
||||
String method = RouteUtil.buildApiName(path);
|
||||
String version = request.getParameter(ParamNames.VERSION_NAME);
|
||||
if (version == null) {
|
||||
version = "1.0";
|
||||
version = defaultVersion;
|
||||
}
|
||||
request.setAttribute(SopConstants.REDIRECT_METHOD_KEY, method);
|
||||
request.setAttribute(SopConstants.REDIRECT_VERSION_KEY, version);
|
||||
|
@@ -21,6 +21,8 @@ zuul.FormBodyWrapperFilter.pre.disable=true
|
||||
zuul.Servlet30WrapperFilter.pre.disable=true
|
||||
# 不用改,如果要改,请全局替换修改
|
||||
zuul.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC
|
||||
# 不用改
|
||||
zuul.rest-default-version=1.0
|
||||
|
||||
# https://blog.csdn.net/qq_36872046/article/details/81058045
|
||||
# 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。
|
||||
|
Reference in New Issue
Block a user