1. Create a controller method that creates a DefaultHttpHeaders object, then calls lastModified(...).withNoETag()
2. Hit the method in a browser; verify that the response contains a "Last-Modified" header and no "ETag" header
3. Refresh the browser
4. Verify that the browser request contains an "If-Modified-Since" header with the same date
5. Look at the http response code
The controller returns a 200 OK instead of a 304 Not Modified, so the browser can't use its cache.
DefaultHttpHeaders has code (DefaultHttpHeaders.java ln 132) that tries to determine whether the last modified date matches the "If-Modified-Since" header. However, it does so by making a string comparison between the header string ("Tue Sep 07 16:34:08 PDT 2010") and a number of milliseconds ("112345..."), which is going to fail.
I worked around this by adding custom code to the controller that compares lastModified and If-Modified-Since, and calls withStatus(HttpServletResponse.SC_NOT_MODIFIED) if appropriate, but it would be cleaner if DefaultHttpHeaders handled this automatically (as it is obviously trying to do).