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 java.io.File.
To Run: