tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Pierazzini <make...@gmail.com>
Subject Re: weird tomcat5.0.30 behaviour with jar in WEB-INF/classes
Date Wed, 01 Dec 2004 15:21:09 GMT
On Wed, 01 Dec 2004 09:49:33 -0500, Wade Chandler
<wchandler@redesetgrow.com> wrote:

> I never try to use relative paths in getResource.  I always do this
> getResource("/pippo.jar");  Also, I usually pick a class in my package
> that I know will certainly be in my web-app classes folder or one of
> it's jars.  This way the classloader used for my call will know about my
> objects and classes at it's level....so it doesn't make delegate
> calls...and I use com.mydomain.mypackage.MyClass.class.getResource
> instead of using the classloader call though that should not matter....

asking resources to classes or classloaders is the same thing:
absolute paths for classes are relative paths for classloaders so the
following lines are equivalent:

com.mydomain.mypackage.MyClass.class.getResource("/xx.txt")
com.mydomain.mypackage.MyClass.class.getClassLoader().getResource("xx.txt")

I pick a class in my package too: if you pick another class you don't
know which classloader you 're using (common/shared/ etc.)

bye

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


Mime
View raw message