summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
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
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 '')
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java37
-rw-r--r--sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java4
-rw-r--r--sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java4
-rw-r--r--sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java2
-rw-r--r--sca-java-2.x/trunk/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java28
-rw-r--r--sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java2
6 files changed, 45 insertions, 32 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
index fc31bcaa50..74322706ad 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
@@ -118,8 +118,15 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem
// of external policy attachment
isRampartRequired = PolicyHelper.isIntentRequired(wsBinding, Constants.AUTHENTICATION_INTENT) ||
PolicyHelper.isIntentRequired(wsBinding, Constants.CONFIDENTIALITY_INTENT) ||
- PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT);
-
+ PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT);
+
+
+ // Apply the configuration from any other policies
+
+ for (PolicyProvider pp : endpoint.getPolicyProviders()) {
+ pp.configureBinding(this);
+ }
+
// Update port addresses with runtime information
// We can safely assume there is only one port here because you configure
// a binding in the following ways:
@@ -138,22 +145,16 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem
endpointURI = Axis2EngineIntegration.getPortAddress(wsdlPort);
- if (!endpointURI.startsWith("jms:")) {
+ if (endpointURI.startsWith("jms:")) {
+ isJMSRequired = true;
+ } else {
if (servletHost == null) {
throw new ServiceRuntimeException("No Servlet host is avaible for HTTP web services");
}
- endpointURI = servletHost.getURLMapping(endpointURI).toString();
- } else {
- isJMSRequired = true;
- }
- Axis2EngineIntegration.setPortAddress(wsdlPort, endpointURI);
+ endpointURI = servletHost.getURLMapping(endpointURI, httpSecurityContext).toString();
+ }
-
- // Apply the configuration from any other policies
-
- for (PolicyProvider pp : endpoint.getPolicyProviders()) {
- pp.configureBinding(this);
- }
+ Axis2EngineIntegration.setPortAddress(wsdlPort, endpointURI);
// Apply the configuration from the mayProvides intents
@@ -161,13 +162,13 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem
// TODO - do we need to go back to configurator?
}
+ if (isMTOMRequired) {
+ new Axis2MTOMPolicyProvider(endpoint).configureBinding(configContext);
+ }
+
if (isJMSRequired){
// TODO - do we need to go back to configurator?
}
-
- if (isMTOMRequired) {
- new Axis2MTOMPolicyProvider(endpoint).configureBinding(configContext);
- }
}
private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
index 46f819d6b9..6cee3142ca 100644
--- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
+++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
@@ -153,8 +153,8 @@ public class DefaultServletHostExtensionPoint implements ServletHostExtensionPoi
return getServletHost().getServletMapping(uri);
}
- public URL getURLMapping(String uri) {
- return getServletHost().getURLMapping(uri);
+ public URL getURLMapping(String uri, SecurityContext securityContext) {
+ return getServletHost().getURLMapping(uri, securityContext);
}
public Servlet removeServletMapping(String uri) throws ServletMappingException {
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
index 668b069bf9..776de4a361 100644
--- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
+++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
@@ -119,12 +119,12 @@ public class ExtensibleServletHost implements ServletHost {
return getDefaultServletHost().getContextPath();
}
- public URL getURLMapping(String uri) {
+ public URL getURLMapping(String uri, SecurityContext securityContext) {
if (servletHosts.getServletHosts().isEmpty()) {
throw new ServletMappingException("No servlet host available");
}
- return getDefaultServletHost().getURLMapping(uri);
+ return getDefaultServletHost().getURLMapping(uri, securityContext);
}
public void setContextPath(String path) {
diff --git a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
index 6747472bc1..f5e375a2ed 100644
--- a/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
+++ b/sca-java-2.x/trunk/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
@@ -120,7 +120,7 @@ public interface ServletHost {
* Returns the complete URL mapped to the specified URI.
* @return the URL mapped to the specified URI
*/
- URL getURLMapping(String uri);
+ URL getURLMapping(String uri, SecurityContext securityContext);
/**
* Set an attribute in the application ServletContext
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;
diff --git a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
index 3d9937f42c..f1d485b6c2 100644
--- a/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
+++ b/sca-java-2.x/trunk/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
@@ -133,7 +133,7 @@ public class WebAppServletHost implements ServletHost {
return servlet;
}
- 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