Caching in Wicket 1.5Page added by Peter ErtlThings that changed from Wicket 1.4 to Wicket 1.5Wicket always sends a Date header for pages and resourcesThis header is important for proper caching and recommended by RFC-2616. Especially when using Expires or Last-Modified the browser has a server-based time to refer to and calculate durations (e.g. until cache expiry) and such. Caching is disabled more reliably and consistentlyCaching is uniformly disabled now by sending the following HTTP response headers: Cache-Control: no-cache, no-store The 'Pragma' header is relevant for HTTP/1.0 client. HTTP/1.1 client usually only care about 'Cache-Control'. The 'no-cache' value does not, as the name indicates, forbid caching but only means the client has to revalidate the previous response with the origin server before reusing it. However the semantics of this header changed as so many people used it incorrectly. The 'no-store' value is effectively prohibiting any kind of storage of the web response and since the previous change of 'no-cache' semantics was actually stronger in prohibiting caching. We are not sending 'Cache-Control: must-revalidate' anymore since it implies the resource can theoretically be cached when in fact it must not. The 'Expires' header is one more protection against caching. All Wicket pages are by default non-cacheable and use these headers.
Cache-Control: public , max-age=timespan In the past Wicket did not always set these headers consistently, now it should. The 'Cache-Control: public' part means the response may be cached by public caches and proxies. When using 'Cache-Control: private' responses may only be cached by the browser and not by any public cache. Wicket resource by default use 'private' to avoid caching of confidential resource in public. Be aware that some (older?) versions of Firefox do not cache any SSL content when using 'private'. The 'Vary: Accept-Encoding' is required to make caches aware that different versions of the resource could exist in cache (e.g. when a cache supports 'gzipped' and 'uncompressed' resources).
As experienced in nginx-0.7 caches, when set up very aggressively, may cache server side redirects (http status = 302). As Wicket relies on dynamic redirects it explicitly disables caching in '302' responses.
In special cases you can enable or disable caching for a WebResponse with: #org.apache.wicket.request.http.WebResponse#disableCaching() // disable caching
when using org.apache.wicket.request.resource.ResourceResponse from org.apache.wicket.request.resource.AbstractResource you can use: ResourceResponse#disableCaching() // make resource response non-cacheable
Change Notification Preferences
View Online
|
Add Comment
|
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
- [CONF] Apache Wicket > Caching in Wicket 1.5 confluence
