tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r609657 - in /incubator/tuscany/branches/sca-java-1.1/modules: binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
Date Mon, 07 Jan 2008 16:07:00 GMT
Author: antelder
Date: Mon Jan  7 08:06:59 2008
New Revision: 609657

URL: http://svn.apache.org/viewvc?rev=609657&view=rev
Log:
Copy context path fixes from trunk to get chat sample working

Modified:
    incubator/tuscany/branches/sca-java-1.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
    incubator/tuscany/branches/sca-java-1.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java

Modified: incubator/tuscany/branches/sca-java-1.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java?rev=609657&r1=609656&r2=609657&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
(original)
+++ incubator/tuscany/branches/sca-java-1.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
Mon Jan  7 08:06:59 2008
@@ -146,7 +146,7 @@
         // Use the DWR remoter to generate the JavaScipt function for each SCA service  
     
         Remoter remoter = (Remoter)getContainer().getBean(Remoter.class.getName());
 
-        String path = request.getContextPath() + request.getServletPath();
+        String path = request.getServletPath();
 
         for (String serviceName : services.keySet()) {
             String serviceScript = remoter.generateInterfaceScript(serviceName, path);

Modified: incubator/tuscany/branches/sca-java-1.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java?rev=609657&r1=609656&r2=609657&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
(original)
+++ incubator/tuscany/branches/sca-java-1.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
Mon Jan  7 08:06:59 2008
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.host.webapp;
 
 import java.io.IOException;
+import java.util.StringTokenizer;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
@@ -69,13 +70,34 @@
                 if (path.length() == 0) {
                     path = super.getPathInfo();
                 }
-                path = path.substring(servletPath.length());
+
+                // TODO: another context path hack, revisit when context path is sorted out
+                path = fiddlePath(path, servletPath);
+                
                 return path;
             }
         };
         return requestWrapper;
     }
     
+    /**
+     * Remove any path suffix thats part of the servlet context path
+     */
+    protected String fiddlePath(String path, String servletPath) {
+        StringTokenizer st = new StringTokenizer(path, "/");
+        String root = "";
+        while (st.hasMoreTokens()){
+                String s = st.nextToken();
+                if (servletPath.endsWith((root + "/" + s))) {
+                        root += "/" + s;
+                } else {
+                        break;
+                }
+        }
+        String fiddlePath = path.substring(root.length());
+        return fiddlePath;
+    }
+
     public void forward(ServletRequest request, ServletResponse response) throws ServletException,
IOException {
         servlet.service(createRequestWrapper(request), response);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message