tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <>
Subject Re: Servlet WAR file and path names
Date Thu, 06 Apr 2000 23:27:20 GMT
Colin Evans wrote:
> Hi, I'm currently writing a servlet application that loads several .XSL XSLT
> files for processing XML data, and I would like to bundle these .XSL files
> in a WAR archive so that the application can be deployed in one peice.
> However, I cannot figure out how to find or generate a file path to
> reference these files relative to the location of the WAR distributable.  I
> always end up entering the file locations by hand for each deployment, or
> entering them as parameters in the web.xml application config file.
> 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!

Take a look at the ServletContext getResource() and getResourceAsStream()
methods. The give you access to resources specified as paths relative to
the context path, so it should give you the portability you need.

Hans Bergsten
Gefion Software

View raw message