Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B80EB10EFE for ; Wed, 26 Feb 2014 23:00:29 +0000 (UTC) Received: (qmail 16827 invoked by uid 500); 26 Feb 2014 23:00:27 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 16776 invoked by uid 500); 26 Feb 2014 23:00:26 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 16768 invoked by uid 99); 26 Feb 2014 23:00:26 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Feb 2014 23:00:26 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 80E5A89FAFB; Wed, 26 Feb 2014 23:00:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <1d8a3b93c1ab4073a94e9043fcf51098@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [CXF-5575] Trying to avoid using '/' as servlet path when possible Date: Wed, 26 Feb 2014 23:00:26 +0000 (UTC) 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 Authored: Wed Feb 26 23:00:06 2014 +0000 Committer: Sergey Beryozkin 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