Crucible 2.3 : Conditional Get
This page last changed on Nov 19, 2009 by edawson.
Conditional Get allows lightweight polling of resources. The REST API makes Crucible available to remote applications. Depending on the type of application, it can be quite common to poll a certain resource periodically to be able to detect changes. For example, an application may request /reviews-v1/filter/Review at regular intervals and notify the user when a new review was added. However, polling a server constantly for potential updates could cause undesired overhead, especially when the response is large. To better facilitate applications that need to poll frequently, Crucible implements HTTP Conditional Get. Conditional GetWith Conditional Get, the server keeps track of when the last change was made to a resource and sends this timestamp along in each HTTP response ("Last-Modified: Wed, 01 Oct 2008 03:37:58 GMT"). At the same time, a client that understands Conditional Get and polls the same resource periodically, will in turn keep track of the Last-Modified timestamp of each resource it has requested and send it along as a request header at every request ("If-Modified-Since: Mon, 29 Sep 2008 06:47:04 GMT"). When the resource has not been modified since the last time the client requested it (Last-Modified <= If-Modified-Since), the server will not serve the request, but return status 204 "Not Modified" with an empty response body. If the resource was modified, the server will respond normally (200 with the resource in the body). Note that Crucible also sends the ETag response header along with Last-Modified. The ETag header contains a checksum of the response document and allows the client to detect changes even when the Last-Modified time did not change. A client that implements Conditional Get should send the value of the ETag response header in the If-None-Match request header. For more information on HTTP Conditional Get, please refer to the HTTP specification. CompatibilityServers implementing Conditional Get are completely compatible with clients that don't understand it and vice versa. |
![]() |
Document generated by Confluence on Jul 29, 2010 20:01 |