dev@jsr311.java.net

Re: Issues 14, 15 refactoring _at_HttpMethod

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 24 Oct 2007 17:31:10 -0400

On Oct 16, 2007, at 1:13 PM, Marc Hadley wrote:
>
>> URLTemplate, considering these are all intended to be
>> dereferenceable by
>> HTTP?
>>
> Fair enough but ideally it would be something shorter/snappier. URL,
> like URI is already taken. E.g. it would be nice to be able to write:
>
> @GET @URI("foo/{bar}")
> public Bar getBar(...) ...
>
How about:

@GET @Path("foo/{bar})
public Bar getBar(...) ...

i.e. we rename @UriTemplate to @Path ? Doesn't seem unreasonable
since the value is just a relative path.

Marc.

>
>>
>>> -----Original Message-----
>>> From: Java Community Process JSR #311 Expert List
>>> [mailto:JSR-311-EG_at_JCP.ORG] On Behalf Of Marc Hadley
>>> Sent: Friday, October 12, 2007 9:30 AM
>>> To: JSR-311-EG_at_JCP.ORG
>>> Subject: Issues 14, 15 refactoring @HttpMethod
>>>
>>> Issues 14[1] and 15[2] are about changes to @HttpMethod.
>>> Essentially instead of:
>>>
>>> @HttpMethod
>>> @UriTemplate("foo")
>>> public Foo getFoo()
>>>
>>> you could write
>>>
>>> @GET("foo")
>>> public Foo getFoo()
>>>
>>> I like the conciseness of this but @UriTemplate has other
>>> attributes in addition to the template string and I don't
>>> think it makes sense to duplicate these on other annotations.
>>> Instead I'd propose to make @HttpMethod a meta-annotation and
>>> define a set of annotations for the common HTTP methods using
>>> this meta-annotation, e.g.:
>>>
>>> @Target({ElementType.METHOD})
>>> @Retention(RetentionPolicy.RUNTIME)
>>> @HttpMethod("GET")
>>> public @interface GET {}
>>>
>>> Anyone could define their own annotations for additional HTTP
>>> methods if they so desired since implementations would only
>>> look at the value of meta-annotation to find the HTTP method
>>> for a given annotation.
>>>
>>> With this you could write:
>>>
>>> @GET @UriTemplate("foo")
>>> public Foo getFoo()
>>>
>>> It would be nice of we could also rename UriTemplate to
>>> something shorter but URI is already taken...
>>>
>>> Thoughts ?
>>> Marc.
>>>
>>> [1] https://jsr311.dev.java.net/issues/show_bug.cgi?id=14
>>> [2] https://jsr311.dev.java.net/issues/show_bug.cgi?id=15
>>>
>>> ---
>>> Marc Hadley <marc.hadley at sun.com>
>>> CTO Office, Sun Microsystems.
>>>
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.