public abstract class CacheHttpServlet extends HttpServlet
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.
Modifier and Type | Field and Description |
---|---|
(package private) long |
cacheLastMod |
(package private) String |
cachePathInfo |
(package private) String |
cacheQueryString |
(package private) CacheHttpServletResponse |
cacheResponse |
(package private) String |
cacheServletPath |
(package private) Object |
lock |
Constructor and Description |
---|
CacheHttpServlet() |
Modifier and Type | Method and Description |
---|---|
private boolean |
equal(String s1,
String s2) |
protected void |
service(HttpServletRequest req,
HttpServletResponse res) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
CacheHttpServletResponse cacheResponse
long cacheLastMod
String cacheQueryString
String cachePathInfo
String cacheServletPath
public CacheHttpServlet()
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
service
in class HttpServlet
ServletException
IOException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses