You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Bradley Neuberg <bn...@randomwalk.com> on 1999/12/30 00:23:54 UTC
Re-Do [PATCH] Bug and Bugfix for NetworkClassLoader
I'm sorry; my last bugfix for the getResource code in
org.apache.util.NetworkClassLoader had a bug itself!
Here's a description of the bug: getResource() is not implemented in
org.apache.tomcat.core.ServletClassLoader nor in
org.apache.tomcat.util.NetworkClassLoader. If called on an instance of
ServletClassLoader or NetworkClassLoader then getResource() cascades up
to the superclass ClassLoader which returns the wrong resource. It is
strange that getResource() is not implemented, as getResourceAsStream()
is implemented in NetworkClassLoader.
Here is the correct code:
/** @return The URL that can retrieve the requested resource
if such a resource exists, otherwise returns null */
public URL getResource(String name) {
URL resource;
// Algorithm:
//
// 1. first check the system path for the resource
// 2. next check the delegate/parent class loader for the
resource
// 3. then attempt to get the resource from the url set.
//
// Lets check the system path for the resource.
resource = getSystemResource(name);
// Lets check the parent/delegate class loader for the resource.
if(parent != null) {
resource = parent.getResource(name);
if(resource != null)
return resource;
}
// Lets load it ourselves.
for(Enumeration e = urlset.keys(); e.hasMoreElements();) {
URL url = (URL) e.nextElement();
URLResourceReader urr = (URLResourceReader) urlset.get(url);
if(urr != null) {
// append the name of the resource to the end of this url
if (name.startsWith("/") && url.getFile().endsWith("/"))
name = name.substring(1, name.length());
try {
url = new URL(url.getProtocol(), url.getHost(),
url.getPort(), url.getFile() + name);
}
catch (MalformedURLException ex) {
ex.printStackTrace();
// should never happend
}
return url;
}
}
// nothing found
return null;
}
Tomcat on the Mac
Posted by Joshua Lucas <jo...@stonecottage.com>.
I was wondering if anyone has been able to get Tomcat to run on the Mac. I
downloaded the 3.0 release and tried to run it but there seems to be a
problem with the path to the server.xml file. Is there currently any sort
of limitation in regards to spaces within the path, ie, /Macintosh
HD/tomcat/server.xml?
Also, it can't be built on the Mac because there are some file names that
are longer than 32 characters.
Any help would be greatly appreciated.
thanks,
josh