dev@jsr311.java.net

Re: Consume/Produce and Input/Output

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 04 Jun 2007 13:33:28 +0200

Jerome Louvel wrote:
> Paul,
>
> In the case of Restlet, the resource classes inherit from a parent Resource
> class, and there is a naming contract put in place.
>

OK.


> 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.
>

OK. So we have some consensus around using @HttpMethod (naming aside).

Since you the propose @Output annotation on a method then there is some
nice consistency in allowing @Input to have the same scoping rules as
@Output (then it is not much of a stretch for the scope to be extended
to the class).

Paul

> 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
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

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