tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torg...@vertech.no>
Subject getResource() for files such as /WEB-INF/app.properties?
Date Mon, 07 May 2001 12:19:46 GMT
In the J2EE blueprint, there is an example of a configuration file
residing in the /WEB-INF/ directory which is loaded using getResource(),
see eg. http://java.sun.com/j2ee/blueprints/sample_application/qanda/

excerpt;

"Here is some sample code that gets a configuration file from the
WEB-INF/ directory and parses it as XML.

URL myURL = null;
try {
    myURL = context.getResource("/WEB-INF/mysettings.xml");
} catch (java.net.MalformedURLException ex) {
    System.out.println("Malformed URL exception: " + ex);
}

..."

However, when doing this in tomcat 4.0dev (April 24th snapshot), the
getResource() method only returns null.

Is this supported in tomcat, or does getResource() only return things
that are in the classpath?

I there any other "nice" way of loading a property / xml / other file
from the WEb-INF directory?


-- 
- Torgeir

Mime
View raw message