diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-04-20 00:19:13 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-04-20 00:19:13 +0000 |
commit | 24bb593b60f3a5367f4ca32d991db6514ed976e5 (patch) | |
tree | d29a91683d896495cd4efd43285ea08e821d9ea9 /sca-java-2.x/trunk/modules/host-jetty/src/main/java/org | |
parent | cba00a3e3d60c464fab8f2b4df6e4da7de14ab59 (diff) |
Simplify the HttpPortAllocator and allows the default implementation to
allocate the port based on the system property/environment var (HTTP_PORT/
HTTPS_PORT) or a free port if the value is 0.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1095242 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/host-jetty/src/main/java/org')
-rw-r--r-- | sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java b/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java index a7bfcfea2a..f62f24adc8 100644 --- a/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java +++ b/sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java @@ -49,7 +49,6 @@ import org.apache.tuscany.sca.host.http.HttpScheme; import org.apache.tuscany.sca.host.http.SecurityContext; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.host.http.ServletMappingException; -import org.apache.tuscany.sca.host.http.extensibility.ExtensibleHttpPortAllocator; import org.apache.tuscany.sca.host.http.extensibility.HttpPortAllocator; import org.apache.tuscany.sca.work.WorkScheduler; import org.mortbay.jetty.Connector; @@ -120,19 +119,25 @@ public class JettyServer implements ServletHost, LifeCycleListener { private org.mortbay.log.Logger jettyLogger; public JettyServer(ExtensionPointRegistry registry) { - this(registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(WorkScheduler.class), ExtensibleHttpPortAllocator.getInstance(registry)); + UtilityExtensionPoint utilityExtensionPoint = registry.getExtensionPoint(UtilityExtensionPoint.class); + this.workScheduler = utilityExtensionPoint.getUtility(WorkScheduler.class); + this.httpPortAllocator = utilityExtensionPoint.getUtility(HttpPortAllocator.class); + init(); } protected JettyServer(WorkScheduler workScheduler, HttpPortAllocator httpPortAllocator) { this.httpPortAllocator = httpPortAllocator; this.workScheduler = workScheduler; + init(); + } - this.defaultPort = httpPortAllocator.getDefaultPort(HttpScheme.HTTP); + private void init() { + this.defaultPort = this.httpPortAllocator.getDefaultPort(HttpScheme.HTTP); //handle backdoor to set specific default port in tests if(portDefault > 0) { this.defaultPort = portDefault; } - this.defaultSSLPort = httpPortAllocator.getDefaultPort(HttpScheme.HTTPS); + this.defaultSSLPort = this.httpPortAllocator.getDefaultPort(HttpScheme.HTTPS); AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { trustStore = System.getProperty("javax.net.ssl.trustStore"); |