You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2008/01/25 01:47:29 UTC

svn commit: r615090 - /incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java

Author: jsdelfino
Date: Thu Jan 24 16:47:25 2008
New Revision: 615090

URL: http://svn.apache.org/viewvc?rev=615090&view=rev
Log:
Handle cases where the HTTP get url does not end with a /, redirect to a url with a / to make relative hrefs work in HTML.

Modified:
    incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java

Modified: incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java?rev=615090&r1=615089&r2=615090&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java (original)
+++ incubator/tuscany/java/sca/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java Thu Jan 24 16:47:25 2008
@@ -58,7 +58,11 @@
         // Get the request path
         String path = request.getPathInfo();
         if (path == null) {
-            path ="/";
+            
+            // Redirect to a URL ending with / to make relative hrefs work
+            // relative to the served resource.
+            response.sendRedirect(request.getRequestURL().append('/').toString());
+            return;
         }
 
         // Invoke the get operation on the service implementation
@@ -81,7 +85,9 @@
                 break;
             os.write(buffer, 0, n);
         }
+        os.flush();
         os.close();
+        
     }
 
 }



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