|
|
|
@ -1,9 +1,15 @@
|
|
|
|
|
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.MalformedURLException; |
|
|
|
|
import java.net.URI; |
|
|
|
|
import java.net.URISyntaxException; |
|
|
|
|
import java.net.URL; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author yaohwu |
|
|
|
|
*/ |
|
|
|
@ -135,24 +141,13 @@ public class RemoteWorkspaceURL implements FCloneable {
|
|
|
|
|
*/ |
|
|
|
|
public void refreshIPV6Format() { |
|
|
|
|
String url = this.url; |
|
|
|
|
// 第三次出现"/"的地方
|
|
|
|
|
int webIndex = url.indexOf("/", url.indexOf("://") + 3); |
|
|
|
|
int hostIndex = url.indexOf("["); |
|
|
|
|
int portIndex = url.indexOf("]"); |
|
|
|
|
isContainsRelatedIndex(webIndex, hostIndex, portIndex); |
|
|
|
|
this.host = url.substring(hostIndex, portIndex + 1); |
|
|
|
|
this.port = url.substring(portIndex + 2, webIndex); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param webIndex web指针 |
|
|
|
|
* @param hostIndex 主机指针 |
|
|
|
|
* @param portIndex 端口指针 |
|
|
|
|
* @return 三个指针是否都存在 |
|
|
|
|
*/ |
|
|
|
|
public boolean isContainsRelatedIndex(int webIndex, int hostIndex, int portIndex) { |
|
|
|
|
return webIndex != -1 && hostIndex != -1 && portIndex != -1; |
|
|
|
|
try { |
|
|
|
|
URI uri = new URI(url); |
|
|
|
|
this.host = uri.getHost(); |
|
|
|
|
this.port = String.valueOf(uri.getPort()); |
|
|
|
|
} catch (URISyntaxException e) { |
|
|
|
|
FineLoggerFactory.getLogger().info("error request url"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setHttps(boolean https) { |
|
|
|
@ -255,4 +250,5 @@ public class RemoteWorkspaceURL implements FCloneable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |