Today, I’d like to take a quick moment to demonstrate how to make a simple file server using [[Rewrite]], and any Servlet Container, such as Tomcat, Wildfly, or Jetty. This can enable much easier file updates for static content, such as preventing the need to re-deploy an entire application just to update an image, or document.
[[Rewrite]] is an open-source Routing ↑↓ and /url/{rewriting} solution for Servlet, Java Web Frameworks, and Java EE.
To start, you’ll need to include the Rewrite dependencies in your project. If you’re using maven, this is as simple as making sure your POM has the following entries (You’ll also need the Servlet API):