Browse Source

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

newui
John.Ying 2 years ago
parent
commit
f9e6aa5520
  1. 8
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 17
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java

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

@ -75,7 +75,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
private UILabel uiLabel = new UILabel();
private static final String IPV6_JUDGE_SYMBOL = "[";
/**
* 是否启用 https 勾选框
@ -210,9 +209,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
if (remoteWorkspaceURL.getURL().contains(IPV6_JUDGE_SYMBOL)) {
remoteWorkspaceURL.refreshIPV6Format();
}
fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
@ -329,10 +325,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.remoteWorkspaceURL = Strings.isNullOrEmpty(connection.getUrl())
? RemoteWorkspaceURL.createDefaultURL()
: new RemoteWorkspaceURL(connection.getUrl());
//判断一下IP地址是不是IPV6的格式,如果是的话在拆分地址和端口的时候需要调整一下格式,用[ 或者 ] 判断
if (!Strings.isNullOrEmpty(connection.getUrl()) && connection.getUrl().contains(IPV6_JUDGE_SYMBOL)) {
this.remoteWorkspaceURL.refreshIPV6Format();
}
String username = fromNullable(connection.getUserName()).or(StringUtils.EMPTY);
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);

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

@ -6,12 +6,15 @@ 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";
@ -102,6 +105,7 @@ public class RemoteWorkspaceURL implements FCloneable {
parserWebAndServlet(lefts);
}
}
this.refreshIPV6Format();
}
public boolean hasDefaultHostName() {
@ -139,12 +143,18 @@ public class RemoteWorkspaceURL implements FCloneable {
*/
public void refreshIPV6Format() {
String url = this.url;
if (Strings.isNullOrEmpty(url)) {
return;
}
if (!url.contains(IPV6_JUDGE_SYMBOL) || !url.contains(IPV6_JUDGE_SYMBOL2)) {
return;
}
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");
FineLoggerFactory.getLogger().info("error request url format");
}
}
@ -249,4 +259,7 @@ public class RemoteWorkspaceURL implements FCloneable {
}
}
public static void main(String[] args) {
System.out.println("".contains("/"));
}
}
Loading…
Cancel
Save