Or, alternatively, you can just rely on the class loader which loaded your servlet and it for a Java resource.
1) Put the configuration file under WEB-INF/classes. 2) Then the code will be independent of the servlet API InputStream in = my_class_name.class.getResourceAsStream("/my_configuration"); Tomas Christopher Schultz <[EMAIL PROTECTED]> wrote on 20.10.2006 17:31:51: > Nuno, > > > I have a web-service that i'am trying to pack it in a war file. > > I am trying to store configuration files into WEB-INF/data directory. In > > my web-service init method, I have to load the configuration file that > > was stored in WEB-INF/data directory. Is it possible? How can I do it? > > (from a servlet) > > InputStream in = getServletContext() > .getResourceAsStream("/WEB-INF/your.file") > > Another poster used ServletContext.getRealPath(), but that won't work if > you have an unexpanded WAR file at work. This one should work all the time. > > Don't forget to read the documentation on this method and to check for null! > > -chris > > [attachment "signature.asc" deleted by Tomas Hulek/Czech Republic/IBM] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]