|
|
|
@ -1,13 +1,20 @@
|
|
|
|
|
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 IPV6_JUDGE_SYMBOL = "["; |
|
|
|
|
|
|
|
|
|
private static final String IPV6_JUDGE_SYMBOL2 = "]"; |
|
|
|
|
|
|
|
|
|
public static final String SYSTEM_LOGIN_PATH = "#management/system/login"; |
|
|
|
|
|
|
|
|
@ -98,6 +105,8 @@ public class RemoteWorkspaceURL implements FCloneable {
|
|
|
|
|
parserWebAndServlet(lefts); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//判断一下IPV6
|
|
|
|
|
this.refreshIPV6Format(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean hasDefaultHostName() { |
|
|
|
@ -129,6 +138,27 @@ public class RemoteWorkspaceURL implements FCloneable {
|
|
|
|
|
return this.url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* IPV6地址格式不同,处理字符串的方式不同,需要处理的是port和host |
|
|
|
|
* 形如 http://[XXXX::XXXX:XXXX:XXXX:XXXX]:8080/webroot/decision
|
|
|
|
|
*/ |
|
|
|
|
public void refreshIPV6Format() { |
|
|
|
|
String url = this.url; |
|
|
|
|
if (Strings.isNullOrEmpty(url)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
URI uri = null; |
|
|
|
|
try { |
|
|
|
|
uri = new URI(url); |
|
|
|
|
this.host = uri.getHost(); |
|
|
|
|
this.port = String.valueOf(uri.getPort()); |
|
|
|
|
} catch (URISyntaxException ignored) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setHttps(boolean https) { |
|
|
|
|
isHttps = https; |
|
|
|
|