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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to