tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <>
Subject AW: AW: Reading properties file from ClassPath (ServletContextListener)
Date Thu, 01 Aug 2002 15:02:35 GMT

To read a property from /WEB-INF/classes/com/foo/
you shouldn't use getSystemResource*() as it uses the
Systemclassloader which doesn't know anything about the tomcat 
directories. So you have use getResource*() which uses the 
classloader that loaded you current class.

To the use of getResource() against getResourceAsStream():
AFAIK the only benefit is that you save one line of code.

Ralph Einfeldt
Uptime Internet Solution Center GmbH
Hamburg, Germany
Hosting, Content Management, Java Consulting 

> -----Urspr√ľngliche Nachricht-----
> Von: petra staub []
> Gesendet: Donnerstag, 1. August 2002 16:45
> An:
> Betreff: Re: AW: Reading properties file from ClassPath
> (ServletContextListener)
> with classpath i mean somewhere in the package of my
> web application (context). this would match the first
> path you pointed out in your answer 
> (webapps/{Context}/WEB-INF/classes/com/foo/
> actually i have no special reason i choose getSystemResource
> instead of getSystemResourceAsStream. what whould be the
> benefit of doing do (maybe buffering related aspects?)?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message