Fixed a bug in WebSiteProperties.java where host name defaults were not initialized properly. Also added a toString method.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1540482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian Crum
2013-11-10 15:17:15 +00:00
parent 7043dd0c6b
commit 2ccdb6b312
@@ -34,6 +34,7 @@ import org.ofbiz.entity.GenericValue;
@ThreadSafe
public final class WebSiteProperties {
/**
* Returns a <code>WebSiteProperties</code> instance initialized to the settings found
* in the <code>url.properties</code> file.
@@ -88,13 +89,13 @@ public final class WebSiteProperties {
if (httpPort.isEmpty() && !request.isSecure()) {
httpPort = String.valueOf(request.getServerPort());
}
if (httpHost.isEmpty() && !request.isSecure()) {
if (httpHost.isEmpty()) {
httpHost = request.getServerName();
}
if (httpsPort.isEmpty() && request.isSecure()) {
httpsPort = String.valueOf(request.getServerPort());
}
if (httpsHost.isEmpty() && request.isSecure()) {
if (httpsHost.isEmpty()) {
httpsHost = request.getServerName();
}
webSiteProps = new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps);
@@ -179,4 +180,15 @@ public final class WebSiteProperties {
public boolean getEnableHttps() {
return enableHttps;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{httpPort=");
sb.append(httpPort).append(", ");
sb.append("httpHost=").append(httpHost).append(", ");
sb.append("httpsPort=").append(httpsPort).append(", ");
sb.append("httpsHost=").append(httpsHost).append(", ");
sb.append("enableHttps=").append(enableHttps).append("}");
return sb.toString();
}
}