Browse Source

REPORT-81270 远程连接配置界面处理IPV6格式的url

release/11.0
John.Ying 2 years ago
parent
commit
2a1c2c5019
  1. 4
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 25
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java

4
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -325,6 +325,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl()) this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl())
? RemoteWorkspaceURL.createDefaultURL() ? RemoteWorkspaceURL.createDefaultURL()
: new RemoteWorkspaceURL(connection.getUrl()); : new RemoteWorkspaceURL(connection.getUrl());
//判断一下IP地址是不是IPV6的格式,如果是的话在拆分地址和端口的时候需要调整一下格式,用[ 或者 ] 判断
if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains("[")) {
this.remoteWorkspaceURL.refreshIPV6Format();
}
String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY); String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY);
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY); String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY); String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);

25
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -129,6 +129,31 @@ public class RemoteWorkspaceURL implements FCloneable {
return this.url; return this.url;
} }
/**
* IPV6地址格式不同,处理字符串的方式不同,需要处理的是port和host
* 形如 http://[XXXX::XXXX:XXXX:XXXX:XXXX]:8080/webroot/decision
*/
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;
}
public void setHttps(boolean https) { public void setHttps(boolean https) {
isHttps = https; isHttps = https;

Loading…
Cancel
Save