servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r400214 - in /incubator/servicemix/trunk/servicemix-http/src: main/java/org/apache/servicemix/http/processors/ test/java/org/apache/servicemix/http/ test/resources/org/apache/servicemix/http/
Date Fri, 05 May 2006 23:58:17 GMT
Author: gnodet
Date: Fri May  5 16:58:15 2006
New Revision: 400214

URL: http://svn.apache.org/viewcvs?rev=400214&view=rev
Log:
SM-411 et SM-426: fix servicemix-http client side ssl support

Modified:
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/CommonsHttpSSLSocketFactory.java
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
    incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
    incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/spring.xml

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/CommonsHttpSSLSocketFactory.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/CommonsHttpSSLSocketFactory.java?rev=400214&r1=400213&r2=400214&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/CommonsHttpSSLSocketFactory.java
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/CommonsHttpSSLSocketFactory.java
Fri May  5 16:58:15 2006
@@ -72,13 +72,15 @@
         if (trustStore == null) {
             trustStore = System.getProperty("javax.net.ssl.trustStore");
         }
-        if (trustStore != null && trustStore.startsWith("classpath:")) {
-            try {
-                String res = trustStore.substring(10);
-                URL url = new ClassPathResource(res).getURL();
-                trustStore = url.toString();
-            } catch (IOException e) {
-                throw new JBIException("Unable to find trustStore " + trustStore, e);
+        if (trustStore != null) {
+            if (trustStore.startsWith("classpath:")) {
+                try {
+                    String res = trustStore.substring(10);
+                    URL url = new ClassPathResource(res).getURL();
+                    trustStore = url.toString();
+                } catch (IOException e) {
+                    throw new JBIException("Unable to find trustStore " + trustStore, e);
+                }
             }
             trustStorePassword = ssl.getTrustStorePassword();
             if (trustStorePassword == null) {

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?rev=400214&r1=400213&r2=400214&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Fri May  5 16:58:15 2006
@@ -68,6 +68,7 @@
     protected SoapMarshaler soapMarshaler;
     protected JBIMarshaler jbiMarshaler;
     protected DeliveryChannel channel;
+    private String relUri;
     
     public ProviderProcessor(HttpEndpoint endpoint) {
         this.endpoint = endpoint;
@@ -76,6 +77,17 @@
             this.soapMarshaler.setSoapUri(SoapMarshaler.SOAP_11_URI);
         }
         this.jbiMarshaler = new JBIMarshaler();
+        java.net.URI uri = java.net.URI.create(endpoint.getLocationURI());
+        relUri = uri.getPath();
+        if (!relUri.startsWith("/")) {
+            relUri = "/" + relUri;
+        }
+        if (uri.getQuery() != null) {
+            relUri += "?" + uri.getQuery();
+        }
+        if (uri.getFragment() != null) {
+            relUri += "#" + uri.getFragment();
+        }
     }
 
     public void process(MessageExchange exchange) throws Exception {
@@ -84,7 +96,7 @@
         } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
             return;
         }
-        PostMethod method = new PostMethod(endpoint.getLocationURI());
+        PostMethod method = new PostMethod(relUri);
         SoapMessage soapMessage = new SoapMessage();
         NormalizedMessage nm = exchange.getMessage("in");
         jbiMarshaler.fromNMS(soapMessage, nm);

Modified: incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java?rev=400214&r1=400213&r2=400214&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
Fri May  5 16:58:15 2006
@@ -66,10 +66,6 @@
         }
     }
 
-    /*
-     * TODO: this test should be successfull, but an exception is thrown saying
-     *   unable to find valid certifaction path to requested target
-     * 
     public void testSsl() throws Exception {
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
         InOut me = client.createInOutExchange();
@@ -88,7 +84,6 @@
             logger.info(new SourceTransformer().toString(me.getOutMessage().getContent()));
         }
     }
-    */
 
     public void testMimeWithHttpClient() throws Exception {
         File f = new File(getClass().getResource("servicemix.jpg").getFile());

Modified: incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/spring.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/spring.xml?rev=400214&r1=400213&r2=400214&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/spring.xml
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/test/resources/org/apache/servicemix/http/spring.xml
Fri May  5 16:58:15 2006
@@ -59,6 +59,12 @@
         </sm:component>
       </sm:activationSpec>
 
+      <sm:activationSpec service="testSsl:MyConsumerService" endpoint="myConsumer">
+        <sm:component>
+          <bean class="org.apache.servicemix.components.util.EchoComponent" />
+        </sm:component>
+      </sm:activationSpec>
+
     </sm:activationSpecs>
   </sm:container>
 



Mime
View raw message