Author: adrianc Date: Sun Nov 10 15:17:15 2013 New Revision: 1540482 URL: http://svn.apache.org/r1540482 Log: Fixed a bug in WebSiteProperties.java where host name defaults were not initialized properly. Also added a toString method.
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1540482&r1=1540481&r2=1540482&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Sun Nov 10 15:17:15 2013 @@ -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(); + } }