tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Echerer <m...@tngtech.com>
Subject Re: Classloading questions
Date Mon, 01 May 2006 12:31:51 GMT
Christopher Piggott wrote:
> As an experiment, I placed a file in the webapp dir of a servlet (not in
> WEB-INF but in the directory above it) and attempted to read it using
> getResource().  What I found was that I could not locate the resource unless
> I used getServletContext().getResource().
> 

Your basic assumption that getServletContext().getResource() works by
using classloader means is simply wrong.

If you look at the JavaDoc of ServletContext it says that getResource()
works file based (relative to the context root) and does not use the
classloader.

http://tomcat.apache.org/tomcat-5.0-doc/servletapi/javax/servlet/ServletContext.html#getResource(java.lang.String)


Cheers,
Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message