couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Formatting_with_Show_and_List" by StephaneAlnet
Date Fri, 05 Oct 2012 04:41:52 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Formatting_with_Show_and_List" page has been changed by StephaneAlnet:
http://wiki.apache.org/couchdb/Formatting_with_Show_and_List?action=diff&rev1=31&rev2=32

  === ETags ===
  The ETag for your _show will always be the ETag of the underlying document. This means that
if you sneakily try to provide dynamic content by doing things in your _show function, a browser
will not refresh the page if the dynamic content changes; a browser will pass an If-None-Match
header with the ETag from the previous time it called your _show, and CouchDB will return
the same ETag (because the underlying document has not changed) ''even if the dynamic content
you added has changed'', and a 304 Not Modified header.
  
- You can circumvent this, sort of. The things that go into calculating the ETag for a _show
URL are: the ETag of the underlying document, the requesting user-agent's Accept header, and
the currently logged-in user's roles. So, if the thing you want to alter in the dynamic content
is a "user is logged in"/"user is not logged in" header, make sure that your users have roles
(it doesn't matter what they are); this will ensure that a logged-in user and a non-logged-in
user will get different ETags for the same _show function on the same document.
+ You can circumvent this. In CouchDB up to version 1.2, The things that go into calculating
the ETag for a _show or _list URL are: the ETag of the underlying document, the requesting
user-agent's Accept header, and the currently logged-in user's roles. So, if the thing you
want to alter in the dynamic content is a "user is logged in"/"user is not logged in" header,
make sure that your users have roles (it doesn't matter what they are); this will ensure that
a logged-in user and a non-logged-in user will get different ETags for the same _show function
on the same document.
+ 
+ In CouchDB 1.3, the Etag also uses the currently logged-in user's name; so different users
(and logged-in user vs non-logged-in user) will get different ETags.
  
  === Shows without a document ===
  Technically, you do not have to pass a docid at all. You can just

Mime
View raw message