cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5575] Trying to avoid using '/' as servlet path when possible
Date Wed, 26 Feb 2014 23:00:26 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 227bf1994 -> 4839273a8


[CXF-5575] Trying to avoid using '/' as servlet path when possible


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4839273a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4839273a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4839273a

Branch: refs/heads/master
Commit: 4839273a86561b47ca31314ccd4c65644cd42eec
Parents: 227bf19
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Feb 26 23:00:06 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Feb 26 23:00:06 2014 +0000

----------------------------------------------------------------------
 .../cxf/transport/servlet/AbstractHTTPServlet.java      | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4839273a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
index 353f693..fa10aae 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
@@ -339,8 +339,8 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements
Filter
     
     protected void redirect(HttpServletRequest request, HttpServletResponse response, String
pathInfo) 
         throws ServletException {
-        
-        String theServletPath = dispatcherServletPath == null ? "/" : dispatcherServletPath;
+        boolean customServletPath = dispatcherServletPath != null;
+        String theServletPath = customServletPath ? dispatcherServletPath : "/";
         
         ServletContext sc = super.getServletContext();
         RequestDispatcher rd = dispatcherServletName != null 
@@ -358,7 +358,7 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements
Filter
                 request.setAttribute(entry.getKey(), entry.getValue());
             }
             HttpServletRequestFilter servletRequest = 
-                new HttpServletRequestFilter(request, pathInfo, theServletPath);
+                new HttpServletRequestFilter(request, pathInfo, theServletPath, customServletPath);
             rd.forward(servletRequest, response);
         } catch (Throwable ex) {
             throw new ServletException("RequestDispatcher for path " + pathInfo + " has failed");
@@ -376,10 +376,14 @@ public abstract class AbstractHTTPServlet extends HttpServlet implements
Filter
         
         public HttpServletRequestFilter(HttpServletRequest request, 
                                         String pathInfo,
-                                        String servletPath) {
+                                        String servletPath,
+                                        boolean customServletPath) {
             super(request);
             this.pathInfo = pathInfo;
             this.servletPath = servletPath;
+            if (pathInfo != null && "/".equals(this.servletPath) && !customServletPath)
{
+                this.servletPath = "";
+            }
         }
         
         @Override


Mime
View raw message