In development, however, you sometimes might need a quick-and-dirty solution for serving large amounts of static files stored somewhere on hard disk. One example of such usage would be an service that stores and organizes image files.
Suppose you have a /var/project/images directory which stores a number of images for your project. If you want this directory to be exposed through http protocol, all you have to do is to add a
<Context>parameter to the
<Host>section of Tomcat's
<Server port="8025" shutdown="SHUTDOWN">
<Engine defaultHost="localhost" name="Catalina">
autoDeploy="false" name="localhost" unpackWARs="true"
docBaseparameter is set to the path on hard drive and
pathparameter is set to the context path for your files. Now, if you have a
/var/project/images/sample.pngfile, it can be seen at
http://localhost:8084/project/images/sample.png. Host name and port number may be different on your system, the ones listed here are default for the version of Tomcat bundled with NetBeans.