You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Echerer <me...@tngtech.com> on 2006/05/01 14:31:51 UTC

Re: Classloading questions

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