• Senior Software Engineer • Focused on Customers and Craftsmanship • Leader of the Phoenix Software Engineering Reading Group Mike is a DZone MVB and is not an employee of DZone and has posted 20 posts at DZone. You can read more from them at their website. View Full User Profile

Jetty Browser Cache Control

04.10.2010
| 7922 views |
  • submit to reddit

Do you use Jetty and need to change the default setting for browser cache control? Have a look at the init-param element named cacheControl in webdefault.xml.

Here’s the default configuration for the version of Jetty I use. Note the element is commented.

<!--
<init-param>
<param-name>cacheControl</param-name>
<param-value>max-age=3600,public</param-value>
</init-param>
-->

To enable and configure browser cache control, uncomment and edit the param-value as appropriate. The following example instructs the browser to disable all caching.

<init-param>
<param-name>cacheControl</param-name>
<param-value>no-store,no-cache,must-revalidate</param-value>
</init-param>

For information on Cache-Control, see RFC 2616, Section 14.9.

 

From http://codeaweso.me/2009/09/jetty-browser-cache-control/

Published at DZone with permission of Mike Christianson, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)