DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13040>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13040

can't retrieve external context who's uri is a sub-dir of current context





------- Additional Comments From [EMAIL PROTECTED]  2002-10-23 21:07 -------
ok, from the servlet 2.3 spec:

-----------------------------------------
getContext(String)
  public ServletContext getContext(java.lang.String uripath) 

    Returns a ServletContext object that corresponds to a specified URL on the
    server.
    This method allows servlets to gain access to the context for various 
parts of
    the server, and as needed obtain RequestDispatcher objects from the 
context.
    The given path must be begin with “/”, is interpreted relative to the
    server’s document root and is matched against the context roots of other 
web
    applications hosted on this container.
    In a security conscious environment, the servlet container may return null
    for a given URL.

    Parameters:
    uripath - a String specifying the context path of another web application 
in
    the container.

    Returns: the ServletContext object that corresponds to the named URL, or
    null if either none exists or the container wishes to restrict this access.
-----------------------------------------


There doesn't appear to be anything in here at all suggesting that when you 
call getContext(String) with a parameter specifying a uri which is a sub-dir 
of the current context's uri, it should ignore your request and simply return 
the current context.

I also beleive that the following assumption is incorrect: "In the general 
case, '/store/common' is supposed to return context '/store' if
it exists.".
 
  The spec states that the given path is "matched" against the context roots 
of other web apps.  That implies to me that it must match exactly.

The solutions provided here do not address this bug: "can't retrieve external 
context who's uri is a sub-dir of current context".  Each of them actually 
still has the same problem (except for the initial postings attachment).


Here's a solution, with minimal changes, that fixes this bug:


-----------------------------------------
445c445
<         if ((contextPath.length() > 0) && (uri.startsWith(contextPath))) {
---
>         if ((contextPath.length() > 1) && (uri.equals(contextPath))) {
-----------------------------------------


Ryan Smith

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>

Reply via email to