axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepal Jayasinghe (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (AXIS2-2592) AxisServlet does not respect Servlet Context paths with slashes
Date Wed, 02 May 2007 16:05:16 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Deepal Jayasinghe reassigned AXIS2-2592:
----------------------------------------

    Assignee: Deepal Jayasinghe

> AxisServlet does not respect Servlet Context paths with slashes
> ---------------------------------------------------------------
>
>                 Key: AXIS2-2592
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2592
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: nightly
>         Environment: Tomcat 6 or Glassfish 9 on Windows XP.
>            Reporter: Steven E. Harris
>         Assigned To: Deepal Jayasinghe
>
> AxisServlet.initContextRoot() inspects the Servlet parameter "axis2.find.context" to
figure out whether it should use the "contextRoot" parameter specified in axis2.xml, or attempt
to discover the Servlet's context path from the current request, per this discussion:
> "svn commit: r468722 ..."
> http://mail-archives.apache.org/mod_mbox/ws-axis-cvs/200610.mbox/%3c20061028184831.2FB6B1A9846@eris.apache.org%3e
> The problem lies with the following portion of initContextRoot():
> if (contextRoot == null || contextRoot.trim().length() == 0) {
>     String[] parts = JavaUtils.split(req.getContextPath(), '/');
>     if (parts != null) {
>         for (int i = 0; i < parts.length; i++) {
>             if (parts[i].length() > 0) {
>                 contextRoot = parts[i];
>                 break;
>             }
>         }
>     }
>     if (contextRoot == null || req.getContextPath().equals("/")) {
>         contextRoot = "/";
>     }
>     configContext.setContextRoot(contextRoot);
> }
> For some reason, this code takes the current request's reported context path and splits
it on slashes, taking only the first token as the context path. This fails with Servlets deployed
with context paths containing slashes.
> As an example, my Servlet is deployed with a context path of "2007/04" and an Axis2 "servicePath"
of "ws". That is, services should be found via
>   http://<my server>/2007/04/ws/<service name>
> I specified "2007/04" in axis2.xml as my "contextRoot", but Axis2 winds up ignoring this
parameter anyway if the "axis2.find.context" Servlet parameter is not set to "false". Upon
the first real request arriving, AxisServlet.initContextRoot() runs. It decides to try to
honor the Servlet's context path, and retrieves it via HttpServletRequest.getContextPath().
This function returns "/2007/04". But the "split" operation chops this up and selects "2007"
as the the context root, then proceeds to set this as the configurationContext's contextRoot.
> This causes the configurationContext's serviceContextPath value to get rewritten as "2007/ws",
which fails to locate a service.
> The fix is to not try splitting up the HttpServletRequest's context path. Perhaps you
want to remove the leading slash, but there's no reason that we should be only honoring the
name components before the first slash beyond the leading one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message