I've been using isEntityAvailable() as a guard for null representations and ran into a snag with HEAD requests. The server is returning the Content-Length and Last-Modified header on the HEAD request and the client's Response instance gets an EmptyRepresentation. By default, isAvailable() on EmptyRepresentation returns false and so isEntityAvailable on Request returns false.
The result is that instead of doing: if (response.isEntityAvailable()) { Representation entity = response.getEntity(); ... } I now have to do: Representation entity = response.getEntity(); if (entity!=null) { ... } For other requests where the entity body is returned, the first case works and is more readable (at least, to me). After reading the API documentation again, I'm questioning the value of using isEntityAvailable() as the Represenation instance could cause undesirable error states when isAvailable() returns false for some reason. What is the intended use isEntityAvailable() considering empty entities and requests like HEAD versus those that just might be "slow"? --Alex Milowski ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2834028