Last-Modified
The Last-Modified response header contains a date/time value indicating the
time at which the provided resource was last modified. When a client holds a
(potentially old) version of this resource, it can validate that version by performing
a conditional GET with an If-Modified-Since header set to the time its version
was last modified. If the server has a newer version, it will send the new
version with an updated Last-Modified header. If there is no newer version, the
server will send a 304 Not Modified response with no body, saving time and
bandwidth.
Entity tags (ETags)
Entity tags are short labels that serve to identify a particular version of an entity.
Typically, they are a hash of the response body; in this way, entities can be compared
by exchanging the tag rather than the entire body.
Entity tags, like Last-Modified, also use conditional GET. The client sends a request
with an If-No-Match header specifying the ETag of its latest version. If the server
calculates a different ETag for the newest version of that resource, it will send
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
208 | Chapter 7: REST, Resources, and Web Services
the entire body. But if the calculated ETag matches the one the client sent, a 304
Not Modified response is returned.
There are many different strategies for calculating entity tags, depending on the
application??™s needs.
Pages:
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326