Caching with Servlet 3.0
Dynamic cache provides servlet caching support for the Servlet 3.0 specification.
Be aware of the following API characteristics when using dynamic cache with Servlet 3.0:
- Dynamic cache wraps the ServletRequest and ServletResponse objects with its own cache application wrapper objects that extend ServletRequestWrapper and ServletResponseWrapper objects.
- Dynamic cache is always the first asyncListener added to the ServletRequest.
- Users of startAsync (ServletRequest req, ServletResponse res) and public AsyncContext startAsync() should flush the response before calling this method. Flushing the response ensures any data that is written to the wrapped cache response is not lost.
- Do not read from or write to the request and response objects passed into public void addListener (asyncListener, req, res). Additional wrapping might have occurred since the given AsyncListener was registered, and might be used to release any resources associated with them.
- The do-not-consume property is not supported for Servlet 3.0 when using dynamic cache. The runtime forces the parent servlet to consume subfragments and the do-not-consume property is ignored.
Related:
Java Servlet considerations Task overview: Using the dynamic cache service to improve performance