Browse Source

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

release/11.0
John.Ying 2 years ago
parent
commit
d3db2cb26c
  1. 5
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  2. 30
      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 okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); private UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
private UILabel uiLabel = new UILabel(); private UILabel uiLabel = new UILabel();
private String IPV6_JUDGE_SYMBOL = "["; private static final String IPV6_JUDGE_SYMBOL = "[";
/** /**
* 是否启用 https 勾选框 * 是否启用 https 勾选框
@ -210,6 +210,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private void actionURLInputChange() { private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText()); remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
if (remoteWorkspaceURL.getURL().contains(IPV6_JUDGE_SYMBOL)) {
remoteWorkspaceURL.refreshIPV6Format();
}
fillIndividualField(); fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps()); httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());

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

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