remm 2005/09/08 03:45:14 Modified: catalina/src/share/org/apache/naming/resources DirContextURLStreamHandler.java catalina/src/share/org/apache/catalina/core ApplicationContext.java webapps/docs changelog.xml Log: - 36534: Context relative URLs returned by ServletContext.getResource() for the same path are not equal. - Jan's patch. Revision Changes Path 1.4 +36 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/DirContextURLStreamHandler.java Index: DirContextURLStreamHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/naming/resources/DirContextURLStreamHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DirContextURLStreamHandler.java 27 Feb 2004 14:58:54 -0000 1.3 +++ DirContextURLStreamHandler.java 8 Sep 2005 10:45:13 -0000 1.4 @@ -89,6 +89,41 @@ } + // ------------------------------------------------------------ URL Methods + + + /** + * Override as part of the fix for 36534, to ensure toString is correct. + */ + protected String toExternalForm(URL u) { + // pre-compute length of StringBuffer + int len = u.getProtocol().length() + 1; + if (u.getPath() != null) { + len += u.getPath().length(); + } + if (u.getQuery() != null) { + len += 1 + u.getQuery().length(); + } + if (u.getRef() != null) + len += 1 + u.getRef().length(); + StringBuffer result = new StringBuffer(len); + result.append(u.getProtocol()); + result.append(":"); + if (u.getPath() != null) { + result.append(u.getPath()); + } + if (u.getQuery() != null) { + result.append('?'); + result.append(u.getQuery()); + } + if (u.getRef() != null) { + result.append("#"); + result.append(u.getRef()); + } + return result.toString(); + } + + // --------------------------------------------------------- Public Methods 1.30 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java Index: ApplicationContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- ApplicationContext.java 29 Aug 2005 10:38:38 -0000 1.29 +++ ApplicationContext.java 8 Sep 2005 10:45:14 -0000 1.30 @@ -497,7 +497,7 @@ try { resources.lookup(path); return new URL - ("jndi", null, 0, getJNDIUri(hostName, fullPath), + ("jndi", "", 0, getJNDIUri(hostName, fullPath), new DirContextURLStreamHandler(resources)); } catch (Exception e) { // Ignore 1.369 +4 -1 jakarta-tomcat-catalina/webapps/docs/changelog.xml Index: changelog.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v retrieving revision 1.368 retrieving revision 1.369 diff -u -r1.368 -r1.369 --- changelog.xml 6 Sep 2005 12:50:55 -0000 1.368 +++ changelog.xml 8 Sep 2005 10:45:14 -0000 1.369 @@ -33,7 +33,7 @@ Remove uneeded files in conf. (remm) </fix> <update> - Change distribution file names from jakarta-* to apache-*. + Change distribution file names from jakarta-* to apache-*. (remm) </update> </changelog> </subsection> @@ -49,6 +49,9 @@ <add> <bug>36088</bug>: Add RUNNING.txt and RELEASE-NOTES.txt to fulldocs distro. (yoavs) </add> + <fix> + <bug>36534</bug>: fix equals for URLs returned by ServletContext.getResource() (luehe) + </fix> </changelog> </subsection>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]