summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/host-jetty
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-02-26 14:44:14 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-02-26 14:44:14 +0000
commite4359749c3a2a8e0f44668c53d505e3353a24a96 (patch)
treef524c0dcc7ee7aaeca0aceef63abd3dfae863741 /sca-java-2.x/trunk/modules/host-jetty
parent064aebf9108b61d667a2e99d93b3cd83b9c3d312 (diff)
Pass security context into getURLMapping() so that appropriate scheme/port are chosen when no concrete url is provided by the binding.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@916695 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/host-jetty')
-rw-r--r--sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java28
1 files changed, 20 insertions, 8 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 b526103552..5b722528e5 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
@@ -81,9 +81,11 @@ public class JettyServer implements ServletHost, LifeCycleListener {
private boolean sendServerVersion;
private WorkScheduler workScheduler;
+ // TODO - this static seems to be set by the JSORPC binding unit test
+ // doesn't look to be a great way of doing things
public static int portDefault = 8080;
private int defaultPort = portDefault;
- private int defaultSSLPort = 443;
+ private int defaultSSLPort = 8443;
/**
* Represents a port and the server that serves it.
@@ -331,18 +333,28 @@ public class JettyServer implements ServletHost, LifeCycleListener {
logger.info("Added Servlet mapping: " + addedURL);
}
- public URL getURLMapping(String suri) throws ServletMappingException {
+ public URL getURLMapping(String suri, SecurityContext securityContext) throws ServletMappingException {
URI uri = URI.create(suri);
-
+
// Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
+ String scheme = null;
+ if(securityContext != null && securityContext.isSSLEnabled()) {
+ scheme = "https";
+ } else {
+ scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
}
+
int portNumber = uri.getPort();
if (portNumber == -1) {
- portNumber = defaultPort;
- }
+ if ("http".equals(scheme)) {
+ portNumber = defaultPort;
+ } else {
+ portNumber = defaultSSLPort;
+ }
+ }
// Get the host
String host;