Re: Servlet reading config file from ?? path
From: Magnus Anvin (mav_at_oss.teleca.se)
Date: 02/18/04
- Next message: Grant Collins: "Network programming question"
- Previous message: George Palmer: "Re: Java Events"
- In reply to: Moth: "Servlet reading config file from ?? path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Feb 2004 02:11:38 -0800
"Moth" <not@this.address> wrote in message news:<geGXb.56668$Wa.54293@news-server.bigpond.net.au>...
> I have a web application that needs to read an xml configuration file. How
> can I specify this without knowing the path of the web application?
>
> I've tried using ClassLoader.getSystemResourceAsStream(filename) but this
> doesn't seem to work for my servlet even with the config file in the lib
> folder of the web app.
>
> Can anyone give me any pointers?
I do not know if you are using Tomcat, but if you are I think you
should try to put the file in the /WEB-INF/classes directory of your
application. In this directory you should put classes and resources
that are unpacked. Classes and resources in jar-files should be put in
the /WEB-INF/lib. Classes and resources that are put in these
directories are visible only to the containing web application, but to
no others.
- Next message: Grant Collins: "Network programming question"
- Previous message: George Palmer: "Re: Java Events"
- In reply to: Moth: "Servlet reading config file from ?? path"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|