asolfre / appengine-rest-server

Automatically exported from code.google.com/p/appengine-rest-server
Other
0 stars 0 forks source link

ETag / If-None-Match support #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Ideally REST servers should support these for polling, large data, or low 
bandwidth applications.  Simple implementation is just have the server always 
generate the result as usual, and use hash as ETag.

Original issue reported on code.google.com by j...@neggie.net on 1 Sep 2012 at 6:48

GoogleCodeExporter commented 9 years ago
just wanted to mention that i'm (slowly) working on this.  if have 
GET/if-none-match basically implemented.  working on adding POST/if-match.

Original comment by jahlborn@gmail.com on 29 Sep 2012 at 1:52

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r115.

Original comment by jahlborn@gmail.com on 11 Oct 2012 at 12:59

GoogleCodeExporter commented 9 years ago
The new etag support is optional.  there is a new Dispatcher flag 
"enable_etags" which must be set to True to enable etag handling (as it may add 
some overhead to request processing, not to mention some model changes).

When etag support is enabled:

for GET requests, an ETag header will be returned on the request which applies 
to the _entire_ response body.  additionally, the model elements themselves 
will now include an "etag" attribute which is specific to that model only.  so, 
for a single model retrieval, the header and model value will be the same.  for 
a query operation with multiple models, the header will be an aggregate value 
different from each model value.  GET requests will honor the "If-None-Match" 
header, which can either specify a single value (for single model GETs or an 
entire collection) or multiple values (for each individual model in a 
collection response).  if the "If-None-Match" header is matched, an http 304 
response code will be returned.

for PUT/POST/DELETE requests, the "If-Match" header will be honored.  Like the 
"If-None-Match" header, this can be a single value or multiple values.  
alternatively, the model specific etag values can be provided in the input 
models themselves (in an etag attribute).  If the input etags do not match, an 
http 412 response code will be returned and _no_ modifications will be made on 
the server side.  Additionally, PUT/POST responses will include updated etag 
information similar to GET requests.

This is a summary for now, i'm planning on adding more detailed information to 
the wiki when released.

Original comment by jahlborn@gmail.com on 12 Oct 2012 at 6:29

GoogleCodeExporter commented 9 years ago

Original comment by jahlborn@gmail.com on 12 Oct 2012 at 6:29