You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/07/07 10:06:15 UTC

DO NOT REPLY [Bug 39987] New: - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"

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


DO NOT REPLY [Bug 39987] - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"

Posted by bu...@apache.org.
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


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|5.5.17                      |5.0.31




------- Additional Comments From markt@apache.org  2006-07-07 23:52 -------
This is a duplicate of bug 13040 and has been fixed for the 5.5.x branch
including 5.5.17.

It looks like your contexts are not correctly configured. You should use #
rather than $ when defining context.xml files for sub-contexts so your file
should be called context#sub.xml

I have just re-tested 5.5.x and the behaviour is correct in this version.

I previuosly fixed 13040 in 4.1.x and 5.5.x but not 5.0.x so this bug is valid
for 5.0.x only. I have changed the version accordingly. Please be aware that
further development of the 5.0.x branch is unlikely.

-- 
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


DO NOT REPLY [Bug 39987] - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"

Posted by bu...@apache.org.
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





------- Additional Comments From charly41434@yahoo.de  2006-07-07 08:10 -------
Created an attachment (id=18566)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18566&action=view)
testcase

Files for testing   
add to vanilla 5.5.17

bug is also present in 5.0.30

-- 
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


DO NOT REPLY [Bug 39987] - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"

Posted by bu...@apache.org.
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


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From markt@apache.org  2006-07-28 01:43 -------
Changing this to WONTFIX since the chances of further development on the 5.0.x
branch are pretty slim.

-- 
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


DO NOT REPLY [Bug 39987] - getServletContext().getContext("/context/subcontext") does not give matching "subcontext"

Posted by bu...@apache.org.
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





------- Additional Comments From charly41434@yahoo.de  2006-07-08 07:35 -------
(In reply to comment #2)
Thanks!
> This is a duplicate of bug 13040 and has been fixed for the 5.5.x branch
> including 5.5.17.
Sorry for the dup. I made a simple bugzilla search for "getContext" but I forgot 
to change the "status" from "open" to "all" (better the default would be "all")
> 
> It looks like your contexts are not correctly configured. You should use #
> rather than $ when defining context.xml files for sub-contexts so your file
> should be called context#sub.xml
I wished there would be some indication (warning or even error) in the logfiles 
that the path attribute of <context> deviates from what TC (5.5) has actually 
configured.
I know there is certainly some doc about this...
> 
> I have just re-tested 5.5.x and the behaviour is correct in this version.
I stumbled over this bug in 5.0.30  but I knew that this version is outdated and 
so uninteresting. So I made the (buggy) check against 5.5.17...

> 
> Please be aware that
> further development of the 5.0.x branch is unlikely.
I used 5.0.30 only because its a prerequisite for a purchased webapp.


-- 
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