Sunday, March 06, 2011

Etag processing in Java

As per the HTTP protocol spec ETag is the "entity value for the requested variant".

ETags could be used in conjunction with the "If-None-Match" header in order to take advantage of the client's (browser's) cache. At the first step (first request) our server can generate ETag value for the requested resource and return in during the normal response. Browser will cache the response and the associated ETag value. During the sub-sequential requests browser will send that ETag value back to the server. Server will examine the ETag. As soon as it will be determined that the requested page hasn't changed since last time the same client requested it, server will send back a status code 304 (Not Modified) with an empty body. - see Etag filter from JSOS.

No comments: