| A superclass for HTTP servlets
Use it when the servlet must have its output
cached and automatically resent as appropriate according to the
servlet's getLastModified() method. To take advantage of this class,
a servlet must:
- Extend CacheHttpServlet instead of HttpServlet
- Implement a getLastModified(HttpServletRequest) method as usual
This class uses the value returned by getLastModified() to manage
an internal cache of the servlet's output. Before handling a request,
this class checks the value of getLastModified(), and if the
output cache is at least as current as the servlet's last modified time,
the cached output is sent without calling the servlet's doGet()
method.
In order to be safe, if this class detects that the servlet's query
string, extra path info, or servlet path has changed, the cache is
invalidated and recreated. However, this class does not invalidate
the cache based on differing request headers or cookies; for
servlets that vary their output based on these values (i.e. a session
tracking servlet) this class should probably not be used.
No caching is performed for POST requests.
CacheHttpServletResponse and CacheServletOutputStream
are helper classes to this class and should not be used directly.
This class has been built against Servlet API 2.2. Using it with previous
Servlet API versions should work; using it with future API versions likely
won't work.
If you get the error Cannot resolve symbol method getContentType()
Then include library /lib/compile/servlet.jar when compiling the project.
author: Jason Hunter, Copyright © 1999 version: 0.92, 00/03/16, added synchronization blocks to make thread safe version: 0.91, 99/12/28, made support classes package protected version: 0.90, 99/12/19 |