At Mon, 1 Oct 2007 19:28:09 +0000 (UTC),
Sean Landis <[EMAIL PROTECTED]> wrote:
>
> I was implementing HEAD on a resource and couldn't figure out how to do it
> so I looked at the source for Resource.handleHead() and was surprised to
> see it calls handleGet(). My understanding of HEAD is that it provides
> all but the entity. That seems to imply that that getRepresentation()
> needs to check what method is used and special case HEAD somehow. That is
> awkward and inconsistent with the rest of the method handling paradigm.
>
> One solution is to provide allowHead() and head(). It might make sense
> to implement head() by calling getRepresentation() but this approach
> doesn't require it and fits better with the current method handling
> style.

I don’t understand what the issue is here? Can you not override
handleHead?

Why should you special case getRepresentation? The representation
should be the same. Presumably (correct me if I’m wrong, Restlet
authors) when sending a response to a head request back to the client
the server simply won’t make a call to get the actual content of the
representation. In almost every way the response to the HEAD request
should be the same to a GET, so it makes sense to share the logic.

Also, intuitively allowHead is a bit redundant, since any resource
that allows a GET really should allow a HEAD.

best,
Erik Hetzner

Attachment: pgpBRvwZrLpJV.pgp
Description: PGP signature

Reply via email to