|
|
|
@ -1,17 +1,17 @@
|
|
|
|
|
package com.fr.env; |
|
|
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
import com.fr.stable.FCloneable; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import java.net.URI; |
|
|
|
|
import java.net.URISyntaxException; |
|
|
|
|
import com.fr.third.guava.base.Strings; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author yaohwu |
|
|
|
|
*/ |
|
|
|
|
public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
|
private static final String SLASH = "/"; |
|
|
|
|
private static final String IPV6_JUDGE_SYMBOL = "["; |
|
|
|
|
|
|
|
|
|
private static final String IPV6_JUDGE_SYMBOL2 = "]"; |
|
|
|
@ -126,25 +126,41 @@ public class RemoteWorkspaceURL implements FCloneable {
|
|
|
|
|
this.servlet = servlet != null ? servlet.trim() : StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 用于UI联动的URL,不一定是标准远程设计URL |
|
|
|
|
* |
|
|
|
|
* @return 原始或生成的URL |
|
|
|
|
*/ |
|
|
|
|
public String getURL() { |
|
|
|
|
if (this.url != null) { |
|
|
|
|
return url; |
|
|
|
|
} |
|
|
|
|
String prefix = isHttps ? HTTPS : HTTP; |
|
|
|
|
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY; |
|
|
|
|
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY; |
|
|
|
|
String servletNameSlash = "/"; |
|
|
|
|
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash; |
|
|
|
|
String webAppNameSlash = StringUtils.isNotEmpty(web) ? SLASH : StringUtils.EMPTY; |
|
|
|
|
this.url = prefix + host + portColon + port + webAppNameSlash + web + SLASH + servlet; |
|
|
|
|
return this.url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取用于远程连接的可用URL |
|
|
|
|
* |
|
|
|
|
* @return 远程连接的可用URL |
|
|
|
|
*/ |
|
|
|
|
public String getStandardURL() { |
|
|
|
|
String prefix = isHttps ? HTTPS : HTTP; |
|
|
|
|
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY; |
|
|
|
|
String webAppNameSlash = StringUtils.isNotEmpty(web) ? SLASH : StringUtils.EMPTY; |
|
|
|
|
return prefix + host + portColon + port + webAppNameSlash + web + SLASH; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* IPV6地址格式不同,处理字符串的方式不同,需要处理的是port和host |
|
|
|
|
* 形如 http://[XXXX::XXXX:XXXX:XXXX:XXXX]:8080/webroot/decision
|
|
|
|
|
*/ |
|
|
|
|
public void refreshIPV6Format() { |
|
|
|
|
String url = this.url; |
|
|
|
|
if (Strings.isNullOrEmpty(url)) { |
|
|
|
|
if (StringUtils.isEmpty(url)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) { |
|
|
|
|