Browse Source

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

newui
John.Ying 2 years ago
parent
commit
d3db2cb26c
  1. 5
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 32
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java

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

@ -75,7 +75,7 @@ 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 String IPV6_JUDGE_SYMBOL = "[";
private static final String IPV6_JUDGE_SYMBOL = "[";
/**
* 是否启用 https 勾选框
@ -210,6 +210,9 @@ 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());

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

@ -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 {
}
}
}
}
Loading…
Cancel
Save