Simple Stream

A simple example app that streams a binary file (in this case, an image) from a directory under the WEB-INF directory.

The same technique could be used to stream other types of binary files, such as PDFs or blobs from a database. This example uses ServletContext.getResourceAsStream to pull the file from within the webapp. If you wanted to stream a file from the filesystem that isn't within your webapp, look at

To Run:

  1. Download SimpleStream.war to your TOMCAT_INSTALL/webapps directory.
    If you're using MSIE, make sure it doesn't change the extension to ".zip".
  2. Then, click on this link: