You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Max Z." <wi...@usa.net> on 2002/02/19 21:57:41 UTC

reading content in WEB-INF

This is what is written in the docs:

web/WEB-INF/ - The special configuration files required for your
application, including the web application deployment descriptor (web.xml),
tag library descriptors for custom tag libraries you have created, and other
resource files you wish to include within your web application. Even though
this directory appears to be a subdirectory of your document root, the
Servlet Specification prohibits serving the contents of this directory (or
any file it contains) directly to a client request. Therefore, this is a
good place to store configuration information that is sensitive (such as
database connection usernames and passwords), but is required for your
application to operate successfully.


I am storing a file in the WEB-INF directory and I need to access it with a
servlet, how would I get to it?


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: reading content in WEB-INF

Posted by Fredrik Westermarck <fr...@mdh.se>.
Max Z. wrote:
> I am storing a file in the WEB-INF directory and I need to access it with a
> servlet, how would I get to it?
> 

Use:

InputStream is =
	  getServletContext().getResourceAsStream("/WEB-INF/your.file");


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>