Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Servlet Interest »

Re: trying to run getResourceAsStream(0 from inside a WAR

Carlos Rodriguez

2003-11-19


Hi, thanks to everyone who replied.
 
It turns out that the using the context is the way to go.  Using the Classloader, one can
only go from where the class was loaded, downwards.
 
-carlos rodriguez
-----Original Message-----
From: Mathew Jose Binoi P R [mailto:MathewJ@IBSPLC.COM]
Sent: Wednesday, November 19, 2003 10:40 PM
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Re: trying to run getResourceAsStream(0 from inside a WAR


Hi,

Use ServletContext to get the properties file from WEB_INF/properties folder.

eg:- String logFile = "/WEB-INF/properties/log4j.properties";
        InputStream in = getServletContext().getResourceAsStream(logFile);

Best Regards,
Mathew
___________________________________________________________________________ To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

©2008 junlu.com - Jax Systems, LLC, U.S.A.