dev@jsr311.java.net

RE: Consume/Produce and Input/Output

From: Jerome Louvel <jerome.louvel_at_noelios.com>
Date: Sat, 2 Jun 2007 16:53:46 +0200

Paul,

In the case of Restlet, the resource classes inherit from a parent Resource
class, and there is a naming contract put in place.

In the case of JSR-311, it is different (any POJO can become a resource) and
it could indeed be useful to always be explicit about the methods using an
annotation.

So I agree with you.

Best regards,
Jerome

> -----Message d'origine-----
> De : Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Envoyé : mardi 29 mai 2007 15:56
> À : dev_at_jsr311.dev.java.net
> Objet : Re: Consume/Produce and Input/Output
>
> Paul Sandoz wrote:
> >> Note that put() method doesn't need to be annotated itself
> because its
> >> name
> >> and the presence of @Input ensure it is correctly detected.
> >
> > What happens if the put (or delete/post/head) method does
> not consume
> > any input or produce any output?
> >
>
> I went back and looked at your example and answered my question:
>
> public class ClientResource extends AccountResource {
>
> ...
>
> public void delete() {
> getAccount().getClients().remove(getClient());
> }
>
> so i assume you are relying on a method naming convention (as
> you do in
> Restlet).
>
> I am in general agreement with Dhanji on this.
>
> IMHO it is important to have a clear declarative mechanism,
> that is not
> prone to mis-interpretation or error, to identify Java methods that
> process HTTP requests. This is what annotations are good at :-) an
> annotation (like HttpMethod, or whatever you want to call it)
> provides
> such a clear declarative mechanism.
>
> Paul.
>
> --
> | ? + ? = To question
> ----------------\
> Paul Sandoz
> x38109
> +33-4-76188109
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>