mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.0.3
This commit is contained in:
@@ -38,6 +38,15 @@ public class TraditionalWebappController {
|
|||||||
|
|
||||||
请求前缀将变成:`http://ip:port/aaa/`
|
请求前缀将变成:`http://ip:port/aaa/`
|
||||||
|
|
||||||
|
- 关闭restful功能
|
||||||
|
|
||||||
|
如果不想用该功能,在配置文件指定:
|
||||||
|
|
||||||
|
```properties
|
||||||
|
# 开启restful请求,默认开启
|
||||||
|
sop.restful.enable=false
|
||||||
|
```
|
||||||
|
|
||||||
- 封装请求工具【可选】
|
- 封装请求工具【可选】
|
||||||
|
|
||||||
封装请求,方便调用,针对vue的封装如下:
|
封装请求,方便调用,针对vue的封装如下:
|
||||||
|
@@ -53,6 +53,10 @@ public class IndexFilter implements WebFilter {
|
|||||||
@Value("${sop.gateway-index-path:/}")
|
@Value("${sop.gateway-index-path:/}")
|
||||||
private String indexPath;
|
private String indexPath;
|
||||||
|
|
||||||
|
/** sop.restful.enable=true ,开启restful请求,默认开启 */
|
||||||
|
@Value("${sop.restful.enable:true}")
|
||||||
|
private boolean enableRestful;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Validator validator;
|
private Validator validator;
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ public class IndexFilter implements WebFilter {
|
|||||||
return chain.filter(exchange);
|
return chain.filter(exchange);
|
||||||
}
|
}
|
||||||
// 如果是restful请求,直接转发
|
// 如果是restful请求,直接转发
|
||||||
if (path.startsWith(EnvironmentKeys.SOP_RESTFUL_PATH.getValue())) {
|
if (enableRestful && path.startsWith(EnvironmentKeys.SOP_RESTFUL_PATH.getValue())) {
|
||||||
exchange.getAttributes().put(SopConstants.RESTFUL_REQUEST, true);
|
exchange.getAttributes().put(SopConstants.RESTFUL_REQUEST, true);
|
||||||
String restfulPath = ServerWebExchangeUtil.getRestfulPath(path, EnvironmentKeys.SOP_RESTFUL_PATH.getValue());
|
String restfulPath = ServerWebExchangeUtil.getRestfulPath(path, EnvironmentKeys.SOP_RESTFUL_PATH.getValue());
|
||||||
ServerWebExchange newExchange = ServerWebExchangeUtil.getForwardExchange(exchange, restfulPath);
|
ServerWebExchange newExchange = ServerWebExchangeUtil.getForwardExchange(exchange, restfulPath);
|
||||||
|
@@ -6,6 +6,9 @@ sop.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC
|
|||||||
# 网关入口
|
# 网关入口
|
||||||
sop.gateway-index-path=/
|
sop.gateway-index-path=/
|
||||||
|
|
||||||
|
# 开启restful请求,默认开启
|
||||||
|
sop.restful.enable=true
|
||||||
|
|
||||||
# nacos cloud配置
|
# nacos cloud配置
|
||||||
spring.cloud.nacos.discovery.server-addr=${register.url}
|
spring.cloud.nacos.discovery.server-addr=${register.url}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user