You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/08 02:32:01 UTC

svn commit: r429522 - in /incubator/servicemix/trunk/servicemix-http/src: main/java/org/apache/servicemix/http/ManagedContextManager.java test/java/org/apache/servicemix/http/HttpManagedTest.java

Author: gnodet
Date: Mon Aug  7 17:32:01 2006
New Revision: 429522

URL: http://svn.apache.org/viewvc?rev=429522&view=rev
Log:
Fix servicemix-http when running in managed mode with a non-empty context path

Modified:
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ManagedContextManager.java
    incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ManagedContextManager.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ManagedContextManager.java?rev=429522&r1=429521&r2=429522&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ManagedContextManager.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ManagedContextManager.java Mon Aug  7 17:32:01 2006
@@ -111,7 +111,7 @@
             Set urls = managedContexts.keySet();
             for (Iterator iter = urls.iterator(); iter.hasNext();) {
                 String url = (String) iter.next();
-                if (uri.startsWith(mapping + url)) {
+                if (uri.startsWith(request.getContextPath() + mapping + url)) {
                     HttpProcessor proc = (HttpProcessor) managedContexts.get(url);
                     proc.process(request, response);
                     return;
@@ -141,7 +141,7 @@
                     context += "/";
                 }
                 String protocol = request.isSecure() ? "https" : "http";
-                context = protocol + "://" + request.getLocalName() + ":" + request.getLocalPort() + mapping + context; 
+                context = protocol + "://" + request.getLocalName() + ":" + request.getLocalPort() + request.getContextPath() + mapping + context; 
                 writer.write("<li><a href=\"");
                 writer.write(context);
                 writer.write("?wsdl\">");

Modified: incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java?rev=429522&r1=429521&r2=429522&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java Mon Aug  7 17:32:01 2006
@@ -43,7 +43,7 @@
 
     public void test() throws Exception {
         ContextHandler context = new ContextHandler();
-        context.setContextPath("/");
+        context.setContextPath("/test");
         context.setEventListeners(new EventListener[] { new ContextLoaderListener() });
         Map initParams = new HashMap();
         initParams.put("contextConfigLocation", "classpath:org/apache/servicemix/http/spring-web.xml");
@@ -76,7 +76,7 @@
         
         System.err.println("Started");
         
-        PostMethod post = new PostMethod("http://localhost:8080/jbi/Service/");
+        PostMethod post = new PostMethod("http://localhost:8080/test/jbi/Service/");
         post.setRequestEntity(new StringRequestEntity("<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope'><soap:Body><hello>world</hello></soap:Body></soap:Envelope>"));
         new HttpClient().executeMethod(post);
         if (post.getStatusCode() != 200) {