|
|
@ -1,10 +1,9 @@ |
|
|
|
package com.fr.env; |
|
|
|
package com.fr.env; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author yaohwu |
|
|
|
* @author yaohwu |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -42,6 +41,7 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
private String port; |
|
|
|
private String port; |
|
|
|
private String web; |
|
|
|
private String web; |
|
|
|
private String servlet; |
|
|
|
private String servlet; |
|
|
|
|
|
|
|
private String url; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -51,7 +51,7 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
* @param url x:x/x/x/x |
|
|
|
* @param url x:x/x/x/x |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public RemoteWorkspaceURL(String url) { |
|
|
|
public RemoteWorkspaceURL(String url) { |
|
|
|
|
|
|
|
this.url = url; |
|
|
|
// 没有写协议名称 默认 使用 http 协议
|
|
|
|
// 没有写协议名称 默认 使用 http 协议
|
|
|
|
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) { |
|
|
|
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) { |
|
|
|
url = HTTP + url; |
|
|
|
url = HTTP + url; |
|
|
@ -116,11 +116,15 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getURL() { |
|
|
|
public String getURL() { |
|
|
|
|
|
|
|
if (this.url != null) { |
|
|
|
|
|
|
|
return url; |
|
|
|
|
|
|
|
} |
|
|
|
String prefix = isHttps ? HTTPS : HTTP; |
|
|
|
String prefix = isHttps ? HTTPS : HTTP; |
|
|
|
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY; |
|
|
|
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY; |
|
|
|
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY; |
|
|
|
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY; |
|
|
|
String servletNameSlash = StringUtils.isNotEmpty(servlet) ? "/" : StringUtils.EMPTY; |
|
|
|
String servletNameSlash = StringUtils.isNotEmpty(servlet) ? "/" : StringUtils.EMPTY; |
|
|
|
return prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet; |
|
|
|
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet; |
|
|
|
|
|
|
|
return this.url; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -164,26 +168,24 @@ public class RemoteWorkspaceURL implements FCloneable { |
|
|
|
return servlet; |
|
|
|
return servlet; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void resetUrl() { |
|
|
|
|
|
|
|
this.url = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|
if (this == o) { |
|
|
|
return o instanceof RemoteWorkspaceURL && AssistUtils.equals(isHttps, ((RemoteWorkspaceURL) o).isHttps) |
|
|
|
return true; |
|
|
|
&& AssistUtils.equals(host, ((RemoteWorkspaceURL) o).host) |
|
|
|
} |
|
|
|
&& AssistUtils.equals(port, ((RemoteWorkspaceURL) o).port) |
|
|
|
if (o == null || getClass() != o.getClass()) { |
|
|
|
&& AssistUtils.equals(web, ((RemoteWorkspaceURL) o).web) |
|
|
|
return false; |
|
|
|
&& AssistUtils.equals(servlet, ((RemoteWorkspaceURL) o).servlet) |
|
|
|
} |
|
|
|
&& AssistUtils.equals(url, ((RemoteWorkspaceURL) o).url); |
|
|
|
RemoteWorkspaceURL that = (RemoteWorkspaceURL) o; |
|
|
|
|
|
|
|
return isHttps == that.isHttps && |
|
|
|
|
|
|
|
Objects.equals(host, that.host) && |
|
|
|
|
|
|
|
Objects.equals(port, that.port) && |
|
|
|
|
|
|
|
Objects.equals(web, that.web) && |
|
|
|
|
|
|
|
Objects.equals(servlet, that.servlet); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int hashCode() { |
|
|
|
public int hashCode() { |
|
|
|
|
|
|
|
|
|
|
|
return Objects.hash(isHttps, host, port, web, servlet); |
|
|
|
return AssistUtils.hashCode(isHttps, host, port, web, servlet, url); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|