Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 96258 invoked from network); 2 Dec 2002 17:06:03 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 Dec 2002 17:06:03 -0000 Received: (qmail 28308 invoked by uid 97); 2 Dec 2002 17:06:48 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 28273 invoked by uid 97); 2 Dec 2002 17:06:47 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 28261 invoked by uid 98); 2 Dec 2002 17:06:46 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: How do I access files above and below \web-inf folder? Date: Mon, 2 Dec 2002 12:04:26 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How do I access files above and below \web-inf folder? Thread-Index: AcKaIXzYuc8mgY/CRHiv4W3dTMDy2AAA1IEA From: "Shapira, Yoav" To: "Tomcat Users List" , =?iso-8859-1?Q?Esteban_Gonz=E1lez?= X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Howdy, Use a ServletContextListener and load these things in the = contextInitialized() method. The ServletContextEvent has a reference to = the ServletContext. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Esteban Gonz=E1lez [mailto:egonzalez@outside.com.ar] >Sent: Monday, December 02, 2002 11:38 AM >To: Tomcat Users List >Subject: Re: How do I access files above and below \web-inf folder? > >Hi, > What if I don=B4t have a way to access to any kind of = ServletContext.? > > Let=B4s say i have a static class that loads properties, but i want = it to >use ServletContext.getResource(..). Unfortunately there=B4s no static = method >around to the a reference to the servletContext. > > any ideas? > > Best regards, > Esteban > >----- Original Message ----- >From: "Tim Moore" >To: "Tomcat Users List" >Sent: Monday, December 02, 2002 1:31 PM >Subject: RE: How do I access files above and below \web-inf folder? > > >You should probably use ServletContext.getResource or >ServletContext.getResourceAsStream > >http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletConte= >xt.html#getResource(java.lang.String) > >http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletConte= >xt.html#getResourceAsStream(java.lang.String) > >That way, it will still work if your web app is packaged as a WAR file. >The path argument is context-relative. > >-- >Tim Moore / Blackboard Inc. / Software Engineer >1899 L Street, NW / 5th Floor / Washington, DC 20036 >Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > >> -----Original Message----- >> From: Mehdi.Nejad@bluewave.com [mailto:Mehdi.Nejad@bluewave.com] >> Sent: Monday, December 02, 2002 5:06 AM >> To: Tomcat Users List >> Subject: RE: How do I access files above and below \web-inf folder? >> >> >> >> I use the getRealPath, >> >> String pathToPropsFile =3D config.getServletContext().getRealPath >> ("WEB-INF/properties/"); >> >> use "/", as this also works on win platforms, and does not >> need escaping. You should be able to use a relative going up >> the tree, in the argument ("../foo/bar"); >> >> cheers, >> >> Mehdi > >-- >To unsubscribe, e-mail: > >For additional commands, e-mail: > > > >-- >To unsubscribe, e-mail: unsubscribe@jakarta.apache.org> >For additional commands, e-mail: help@jakarta.apache.org> -- To unsubscribe, e-mail: For additional commands, e-mail: