From 19c5d85b1c029029f345b7300eacd4894a50cb14 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 20 Apr 2011 22:34:51 +0000 Subject: Allow the look up of endpoint address by component/service/binding name from the Node API git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1095537 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/host/http/extensibility/HttpPortAllocator.java | 2 ++ .../extensibility/impl/DefaultHttpPortAllocatorImpl.java | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules/host-http/src/main') diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/HttpPortAllocator.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/HttpPortAllocator.java index 71a164df2e..e7324130b1 100644 --- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/HttpPortAllocator.java +++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/HttpPortAllocator.java @@ -27,6 +27,8 @@ import org.apache.tuscany.sca.host.http.HttpScheme; * @version $Rev$ $Date$ */ public interface HttpPortAllocator { + int DEFAULT_HTTP_PORT = 8085; + int DEFAULT_HTTPS_PORT = 8443; /** * Get default port for a given http scheme * @param scheme the http scheme in use (http/https) diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java index af41e85213..544b1ea8df 100644 --- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java +++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/extensibility/impl/DefaultHttpPortAllocatorImpl.java @@ -34,21 +34,21 @@ public class DefaultHttpPortAllocatorImpl implements HttpPortAllocator { if (scheme == null || scheme == HttpScheme.HTTP) { try { - port = Integer.parseInt(getVariable("HTTP_PORT", "8080")); + port = Integer.parseInt(getVariable("HTTP_PORT", String.valueOf(DEFAULT_HTTP_PORT))); if (port == 0) { - port = findFreePort(8080, 9080); + port = findFreePort(DEFAULT_HTTP_PORT, DEFAULT_HTTP_PORT + 1000); } } catch (NumberFormatException e) { - port = 8080; + port = DEFAULT_HTTP_PORT; } } else if (scheme == HttpScheme.HTTPS) { try { - port = Integer.parseInt(getVariable("HTTPS_PORT", "8443")); + port = Integer.parseInt(getVariable("HTTPS_PORT", String.valueOf(DEFAULT_HTTPS_PORT))); if (port == 0) { - port = findFreePort(8443, 9443); + port = findFreePort(DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_PORT + 1000); } } catch (NumberFormatException e) { - port = 8443; + port = DEFAULT_HTTPS_PORT; } } -- cgit v1.2.3