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

http://issues.apache.org/bugzilla/show_bug.cgi?id=39987

           Summary: getServletContext().getContext("/context/subcontext")
                    does not give matching "subcontext"
           Product: Tomcat 5
           Version: 5.5.17
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


If there are 2 contexts declared with the path of the 2nd context is a subpath
of the 1nd context then getContext(subpath) within the 1st context does not give
the 2nd context.
For example:
c:/TOMCATHOME/conf/Catalina/localhost/context$sub.xml:
<Context path="/context/sub" docBase="../webapp2/contextsub" 
crossContext="true">
</Context>

c:/TOMCATHOME/conf/Catalina/localhost/context.xml:
<Context path="/context" docBase="../webapp2/context" crossContext="true">
</Context>

c:/TOMCATHOME/webapp2/context/test.jsp:
<html><body>
<% 

ServletContext self = getServletContext();
ServletContext sub_ctx = self.getContext("/context/sub");

if (self!=sub_ctx)
{ %>
ok: <%=  sub_ctx!=null?sub_ctx.getRealPath("/"):"null" %>

<% } else { %>
NOT ok: Should not be same context: <%= sub_ctx.getRealPath("/") %>

<% } %>
</body></html>


Directory c:/TOMCATHOME/webapp2/contextsub  exists...

Calling http://localhost:8080/context/test.jsp shows:
NOT ok: Should not be same context: c:\TOMCATHOME\webapps\..\webapp2\context\

It should show:
ok: c:\TOMCATHOME\webapps\..\webapp2\contextsub\

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to