tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: read file inside WEB-INF
Date Fri, 20 Oct 2006 15:31:51 GMT

> 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()

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!


View raw message