We recently updated to the newest RC (actually to revision 6570 of
trunk), and now every single 304 response our server returns causes a
WARN-level message to appear in the logs, like this:

WARNING: Responses with a 304 (Not modified) status can't have an
entity. Only adding entity headers for resource
"http://localhost:8080/some/path/here/";.

This doesn't seem desirable.

This message is generated in the ServerAdapter.commit() method, if the
status us 304 and isEntityAvailable() returns true.  This implies it
is incorrect for an representation at this stage (having gone through
condition request handling) to be available.

One change from 3 weeks ago that I found looking at SVN commits was a
change to EmptyRepresentation.java which makes it "available", instead
of unavailable.  (It now passes 'true' instead of 'false' to
setAvailable() in its constructor).  This seems like a pretty
significant change, especially given that there isn't much
documentation for how the EmptyRepresenation is supposed to behave.

In fact, it was our impression that the only way for us to return any
entity metadata during a 304 was in fact to use a subclass of
EmptyRepresentation.  (Although I also noticed a current restlet issue
which claims that this metadata is not, in fact, being actually sent!)

So now, since an EmptyRepresentation is "available", the ServerAdapter
is WARNing about a 304 with a, entity.

However, I don't think the problem is just with EmptyRepresentation,
something else must have changed, maybe in the conditional request
handling, because we have other resources which have no special code
in them at all, but which happen to publish an eTag in the
representation subclass, and which therefor sometimes cause a 304 when
requested, and we also see this warning showing up now for these
requests.

1) what should the state of a representation be after conditional
request handling?
2) how is the EmptyRepresentation supposed to be used?
3) Why is there a warning during a 304 response with an entity?

thanks,
  -Dave Fogel

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2602172

Reply via email to