mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
2.4.1
This commit is contained in:
@@ -21,7 +21,7 @@ sop.restful.enable=true
|
|||||||
|
|
||||||
**注意,`2.4.1`开始多了一个服务id作为区分,这样做是为了避免各微服务之间url冲突,假如两个微服务都有一个叫`/getItems`这样的接口
|
**注意,`2.4.1`开始多了一个服务id作为区分,这样做是为了避免各微服务之间url冲突,假如两个微服务都有一个叫`/getItems`这样的接口
|
||||||
那么调用`http://ip:port/rest/getItems`接口网关无法做出正确的路由,虽然可以在代码上进行规范,为了防止万一,还是强行加上了,避免采坑
|
那么调用`http://ip:port/rest/getItems`接口网关无法做出正确的路由,虽然可以在代码上进行规范,为了防止万一,还是强行加上了,避免采坑
|
||||||
。可以指定`sop.restful.compatibility=true`强制使用老的调用方式**
|
。可以指定`sop.restful.old-model=true`强制使用老的调用方式**
|
||||||
|
|
||||||
> 可在微服务端指定一个配置:`sop.restful.prefix=xxx`。请求路径将变成:`http://ip:port/rest/xxx/your_path`
|
> 可在微服务端指定一个配置:`sop.restful.prefix=xxx`。请求路径将变成:`http://ip:port/rest/xxx/your_path`
|
||||||
|
|
||||||
|
@@ -102,8 +102,8 @@ public class ApiMetaBuilder {
|
|||||||
if (StringUtils.isEmpty(prefix)) {
|
if (StringUtils.isEmpty(prefix)) {
|
||||||
prefix = EnvironmentKeys.SPRING_APPLICATION_NAME.getValue();
|
prefix = EnvironmentKeys.SPRING_APPLICATION_NAME.getValue();
|
||||||
}
|
}
|
||||||
String compatibilityValue = EnvironmentKeys.SOP_RESTFUL_COMPATIBILITY.getValue();
|
String oldModel = EnvironmentKeys.SOP_RESTFUL_OLD_MODEL.getValue();
|
||||||
if (!"true".equals(compatibilityValue) && StringUtils.hasText(prefix)) {
|
if (!"true".equals(oldModel) && StringUtils.hasText(prefix)) {
|
||||||
name = "/" + prefix + "/" + StringUtils.trimLeadingCharacter(path, '/');
|
name = "/" + prefix + "/" + StringUtils.trimLeadingCharacter(path, '/');
|
||||||
}
|
}
|
||||||
ServiceApiInfo.ApiMeta apiMeta = new ServiceApiInfo.ApiMeta(name, path, "");
|
ServiceApiInfo.ApiMeta apiMeta = new ServiceApiInfo.ApiMeta(name, path, "");
|
||||||
|
@@ -15,9 +15,9 @@ public enum EnvironmentKeys {
|
|||||||
SOP_RESTFUL_PREFIX("sop.restful.prefix"),
|
SOP_RESTFUL_PREFIX("sop.restful.prefix"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sop.restful.compatibility=true,兼容老的restful调用方式(2.4.1之前)
|
* sop.restful.old-model=true,兼容老的restful调用方式(2.4.1之前)
|
||||||
*/
|
*/
|
||||||
SOP_RESTFUL_COMPATIBILITY("sop.restful.compatibility", "false");
|
SOP_RESTFUL_OLD_MODEL("sop.restful.old-model", "false");
|
||||||
|
|
||||||
private String key;
|
private String key;
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
|
Reference in New Issue
Block a user