dev@jsr311.java.net

RE: Representation<T> and Entity<T>

From: Jerome Louvel <jerome.louvel_at_noelios.com>
Date: Tue, 10 Apr 2007 12:07:12 +0200

Paul,

> > In the above example I do see how the @MediaType makes it
> easier for
>
> Doh! i meant to say:
>
> "In the above example I do not see.."

To precise my previous response: I do see the value for a MediaType class
and would prefer to see it added at the JDK level. But, I'm not against
having it at the JSR level if it isn't possible to modify the core JSE API.

If all that you need is the media type as a String, then it seems as easy to
do:
  public Entry postEntry(@Input InputStream data, @MediaType String type)
than
  public Entry postEntry(@Input InputStream data, MediaType type)

This is mostly a matter of taste. IMO, the annotation does make it a little
more obvious that the value of the "type" parameter will be injected using
the request's entity media type, rather than magically bound to the first
parameter instance of the MediaType class.

Best regards,
Jerome