tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39987] New: - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"
Date Fri, 07 Jul 2006 08:06:15 GMT
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: charly41434@yahoo.de


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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message