REM:
1. 兼容urlPath结尾没有添加/导致url拼接不正确问题
This commit is contained in:
HuangXin 2021-10-20 09:44:01 +08:00
parent 4ca82e54a4
commit 6a69040854
1 changed files with 10 additions and 2 deletions

View File

@ -144,11 +144,19 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
@Override @Override
public ErrorCode addDisposeAbilityDevice(DisposeDevice dev) { public ErrorCode addDisposeAbilityDevice(DisposeDevice dev) {
DisposeAbility db; DisposeAbility db;
String urlSpiltChar = "/";
String url;
String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://"; String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://";
String addr = (dev.getIpPort() == null || dev.getIpPort() String addr = (dev.getIpPort() == null || dev.getIpPort()
.length() == 0) ? dev.getIpAddr() : (dev.getIpAddr() + ":" + dev.getIpPort()); .length() == 0) ? dev.getIpAddr() : (dev.getIpAddr() + ":" + dev.getIpPort());
String url = httpType + addr + "/" + dev.getUrlPath();
if (dev.getUrlPath().length() == 0) {
url = httpType + addr + urlSpiltChar;
} else if (dev.getUrlPath().endsWith(urlSpiltChar)) {
url = httpType + addr + urlSpiltChar + dev.getUrlPath();
} else {
url = httpType + addr + urlSpiltChar + dev.getUrlPath() + urlSpiltChar;
}
switch (dev.getDeviceType()) { switch (dev.getDeviceType()) {
case DPTECH_UMC: case DPTECH_UMC: