Two Servlet Filters Every Web Application Should Have

Almost every single web application you will ever make will seriously benefit from using servlet filters to both cache and compress content.

A caching filter optimizes the time it takes to send back a response from your web server, and a compression filter optimizes the size of the content that you send from your web server to a user via the Internet.

Since generating content and sending content over the World Wide Web are the bread and butter of web applications, it should be no surprise that simple components that aid in these processes are incredibly useful.


This article details the process of building and using a caching filter and a compression filter that are suitable for use with just about any web application. After reading this article, you will understand caching and compressing, have code to do both, and be able to apply caching and compression to any of your future (or existing!) web applications.

Find more at Two Servlet Filters Every Web Application Should Have - O'Reilly Media.

Comments