incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1242350 - /sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java
Date Thu, 09 Feb 2012 15:05:06 GMT
Author: cziegeler
Date: Thu Feb  9 15:05:05 2012
New Revision: 1242350

URL: http://svn.apache.org/viewvc?rev=1242350&view=rev
Log:
SLING-2410 : Problems with paths ending with .jsp in WebSphere

Modified:
    sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java

Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java?rev=1242350&r1=1242349&r2=1242350&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java
(original)
+++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/webapp/SlingServlet.java
Thu Feb  9 15:05:05 2012
@@ -32,6 +32,7 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.sling.launchpad.base.shared.Launcher;
@@ -151,6 +152,25 @@ public class SlingServlet extends Generi
         Servlet delegatee = sling;
         if (delegatee != null) {
 
+            // check for problematic application servers like WebSphere
+            // where path info and servlet path is set wrong SLING-2410
+            final HttpServletRequest request = (HttpServletRequest) req;
+            if ( request.getPathInfo() == null && request.getServletPath() != null
+                    && request.getServletPath().endsWith(".jsp") ) {
+                req = new HttpServletRequestWrapper(request) {
+
+                    @Override
+                    public String getPathInfo() {
+                        return request.getServletPath();
+                    }
+
+                    @Override
+                    public String getServletPath() {
+                        return "";
+                    }
+
+                };
+            }
             delegatee.service(req, res);
 
         } else if (startFailureCounter > MAX_START_FAILURES) {



Mime
View raw message