This is the way I did it and it worked fine for me. (done on Tomcat 7.x)
Add a <context>
to the tomcat/conf/server.xml
file.
Windows example:
<Context docBase="c:\Documents and Settings\The User\images" path="/project/images" />
Linux example:
<Context docBase="/var/project/images" path="/project/images" />
Like this (in context):
<Server port="8025" shutdown="SHUTDOWN">
...
<Service name="Catalina">
...
<Engine defaultHost="localhost" name="Catalina">
...
<Host appBase="webapps"
autoDeploy="false" name="localhost" unpackWARs="true"
xmlNamespaceAware="false" xmlValidation="false">
...
<!--MAGIC LINE GOES HERE-->
<Context docBase="/var/project/images" path="/project/images" />
</Host>
</Engine>
</Service>
</Server>
In this way, you should be able to find the files (e.g. /var/project/images/NameOfImage.jpg
) under:
http://localhost:8080/project/images/NameOfImage.jpg