Specifically in JAX-RS (I'm not sure that is relevant) there are methods that allow you to add EntityTags to the response. What exactly are entity tags and what practical ways are they used?
Entity Tags are a way of incorporating caching into the HTTP Protocol. When a server returns a response it can attach an ETag
header which gives a value which represents the state of the object returned in response to the client's request.
When the client makes subsequent requests for the same response it can send back the ETag in it's request using the If-None-Match
header and the server can use this to determine whether it needs to send a new response (i.e. the state of the requested object has changed) or whether it can respond with a 304 Not Modified response which instructs the client to use its local cached copy.
This is most often used in RESTful APIs and applications where caching and object state are relevant.
See http://en.wikipedia.org/wiki/HTTP_ETag
In addition to Julians reference: In general, entity tags enable client, server and intermediaries to agree on the specific representation (hence entity tag) of a resource.
The agreement is used for reducing network use (conditional retrieval) and concurrency control (conditional updates). The former works along the lines of "Send me the current representation of this resource if it is not the representation I already have" and the latter works along the lines of "Apply this change to that resource if it still has the state that I expect it to have").
The rest is explained in detail in the HTTp spec.
Jan
See Section 3.11 of RFC 2616.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With