dev@jsr311.java.net

RE: Representation<T> and Entity<T>

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

Paul,

> > If the Entity class can be modified:
> >
> > public class Entity {
> > @MediaType
> > public String getType() {...}
> >
> > @RedirectRef
> > public URI getContentLocation() {...}
> > }

Ooops, I meant Entry instead of Entity.

> > Otherwise:
> >
> > @Method
> > public @Metadata(mediaType="text/foo", language="en") Entry
> > postEntry(@Input InputStream data, @MediaType String type) {
> >
> > or
> >
> > @Method
> > public @MediaType("text/foo") @Language("en") Entry
> > postEntry(@Input InputStream data, @MediaType String type) {
> >
>
> IMHO this puts more work on the developer. They have to
> create their own
> code for some very common cases.

How does it put more work on the developer? The Entry POJO class is
necessary in all cases. Maybe you want Entry to extends a base
Entity/Representation class?

> > So, it
> > should be possible to get the media type as a String.
>
> I agree. This is possible with the existing API proposal.

OK.

> Yes, if only we could :-) In the shorter time-frame we may be able to
> get some sharing between Servlet and this API, which could in
> time get
> put into the JDK. I think it is worth pursuing.

OK.
 
> Yes, I like the idea of including language and character set
> (i do have
> a preference for avoiding field names in annotations for the
> common cases).

Agreed, the default value of the @Input/_at_Output annotations should be for
the media type parameter, unless parameter names are used.

Best regards,
Jerome