From 2ccdb6b312e4ba6aefed7b71e5ea53a482e745ef Mon Sep 17 00:00:00 2001 From: Adrian Crum Date: Sun, 10 Nov 2013 15:17:15 +0000 Subject: [PATCH] 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 --- .../ofbiz/webapp/website/WebSiteProperties.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java b/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java index 55bfd1ac31..5bfa196d01 100644 --- a/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java +++ b/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java @@ -34,6 +34,7 @@ import org.ofbiz.entity.GenericValue; @ThreadSafe public final class WebSiteProperties { + /** * Returns a WebSiteProperties instance initialized to the settings found * in the url.properties 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(); + } }