|
|
@ -1,9 +1,15 @@ |
|
|
|
package com.fr.env; |
|
|
|
package com.fr.env; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
import com.fr.stable.FCloneable; |
|
|
|
import com.fr.stable.FCloneable; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.MalformedURLException; |
|
|
|
|
|
|
|
import java.net.URI; |
|
|
|
|
|
|
|
import java.net.URISyntaxException; |
|
|
|
|
|
|
|
import java.net.URL; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yaohwu |
|
|
|
* @author yaohwu |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -135,24 +141,13 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void refreshIPV6Format() { |
|
|
|
public void refreshIPV6Format() { |
|
|
|
String url = this.url; |
|
|
|
String url = this.url; |
|
|
|
// 第三次出现"/"的地方
|
|
|
|
try { |
|
|
|
int webIndex = url.indexOf("/", url.indexOf("://") + 3); |
|
|
|
URI uri = new URI(url); |
|
|
|
int hostIndex = url.indexOf("["); |
|
|
|
this.host = uri.getHost(); |
|
|
|
int portIndex = url.indexOf("]"); |
|
|
|
this.port = String.valueOf(uri.getPort()); |
|
|
|
isContainsRelatedIndex(webIndex, hostIndex, portIndex); |
|
|
|
} catch (URISyntaxException e) { |
|
|
|
this.host = url.substring(hostIndex, portIndex + 1); |
|
|
|
FineLoggerFactory.getLogger().info("error request url"); |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setHttps(boolean https) { |
|
|
|
public void setHttps(boolean https) { |
|
|
@ -255,4 +250,5 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |