dev@jsr311.java.net

Re: HEAD and OPTIONS

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 29 Jun 2007 10:20:11 +0200

Stefan Tilkov wrote:
> Apologies if this has been discussed before, but what's the status of
> support for HEAD and OPTIONS?
>

I don't recall discussing it before...


> Are these intended to be supported similarly to the main four verbs? Or
> should HEAD and OPTIONS respond 'correctly' (whatever that means)
> automagically? Or both?
>

I think both.


> Intuitively, I think they should behave reasonably based on the
> annotation metadata, but allow for overriding.
>

HEAD could be supported by the runtime calling the GET method and
ignoring the returned entity.

Explicitly the developer could do:

   @HttpMethod("HEAD")
   Response.Builder head() {
     return ...
   }

   @HttpMethod("GET")
   Response get() {
      Object entity = ...
      return head().entity(entity).build();
   }

We allows nice reuse, but only if we allow for Response.Builder as a
return type of an HTTP method.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109