At 05:45 AM 10/14/2003, you wrote:
Howdy,
Yeah, I usually prefer ServletContext#getResource or getResourceAsStream
over the Class loader approach (Justin's suggestion) as well.
Yoav Shapira
Millennium ChemInformatics
Both are definitely good options ... I prefer to go directly to the
Classloader
;Sent: Tuesday, October 14, 2003 2:14 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Can I read file resources from a .WAR file at runtime ?
>
>Justin's suggestion works, but personally I prefer using:
> InputStream is =
>getServletContext().getResourceAsStream("/WEB-INF/myresource&
Justin's suggestion works, but personally I prefer using:
InputStream is =
getServletContext().getResourceAsStream("/WEB-INF/myresource");
"Steph Richardson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I have a web-app that uses several xml, xsd, and other configuration files
Instead of referencing the files through classes in the the java.io
packages, read the files as resources through the Classloader. This is a
*much* preferable way to do what you asking about -- one very good reason
for doing it through the Classloader is the dilema you're facing now.
So to ans
I have a web-app that uses several xml, xsd, and other configuration files at runtime
( including during the Application Init
event ). We keep these files under various directories under WEB-INF so that we can
get their paths at runtime relative to
ServletContext.getRealPath( "WEB-INF" ).
When