tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Hunter <>
Subject Re: Servlet WAR file and path names
Date Fri, 07 Apr 2000 06:05:59 GMT
> > Does Tomcat have a way to give names to non-JSP and servlet
> > resources, or to report the path location of a servlet's web
> > application location?
> > Otherwise, it makes including additional support files very
> > difficult.  Any help or suggestions would be appreciated!
> >
> The convention recommended in the servlet specification is to use
> ServletContext.getResource() or ServletContext.getResourceAsStream()
> to access things like this, rather than doing file i/o.  That way,
> your web app will still work even in an advanced servlet container
> that does not run out of the filesystem.
> The conventional place to store things like this is in the WEB-INF
> directory.
> So if you stored such a file at:
>     WEB-INF/mystylesheet.xsl
> you could access it in a servlet (or JSP page) like this:
>     InputStream stream =
> getServletContext().getResource("/WEB-INF/mystylesheet.xsl");

Now the $64,000 question is: What can you do to have the servlet make 
a *change* to the configuration file under WEB-INF?  The default "file:"
URL in Tomcat doesn't support "output", nor would URL even have a good
API for writing.  Seems to me we have a read-only solution.  There's no
good place to store a webapp's long-term writable files.


View raw message