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 2005/09/07 04:52:05 UTC
DO NOT REPLY [Bug 36534] New: -
Context relative URLs returned by ServletContext.getResource() for the same path are not equal
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=36534>.
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=36534
Summary: Context relative URLs returned by
ServletContext.getResource() for the same path are not
equal
Product: Tomcat 5
Version: Nightly Build
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: jan.luehe@sun.com
Consider the following servlet snippet:
URL main = context.getResource("/WEB-INF/wsdl/hello_literal.wsdl");
URL sub = new URL(main, "hello.xsd");
URL sub1 = context.getResource("/WEB-INF/wsdl/hello.xsd");
While sub.toString().equals(sub1.toString()) is TRUE, sub.equals(sub1)
returns FALSE, where it should also return TRUE.
I noticed the reason sub.equals.(sub1) is FALSE is because their
getHost() values are different:
sub.getHost() -> ""
sub1.getHost() -> null
Notice that in the case of
URL sub = new URL(main, "hello.xsd");
java.net.URLStreamHandler.parseURL() will set host to "", while in the
case of
URL sub1 = context.getResource("/WEB-INF/wsdl/hello.xsd");
which is implemented by
org.apache.catalina.core.ApplicationContext.getResource() as follows:
return new URL
("jndi", null, 0, getJNDIUri(hostName, fullPath),
new DirContextURLStreamHandler(resources));
the host component is set to "null".
Changing
return new URL
("jndi", null, 0, getJNDIUri(hostName, fullPath),
new DirContextURLStreamHandler(resources));
to
return new URL
("jndi", "", 0, getJNDIUri(hostName, fullPath),
new DirContextURLStreamHandler(resources));
in ApplicationContext.getResource() fixes the problem.
Unfortunately, I am having cvs problems, otherwise i would have committed
the fix myself.
--
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org