users@jsr311.java.net

Misprint or what? (JSR311 June 27, 2008)

From: Konstantin Bulenkov <kb_at_jetbrains.com>
Date: Thu, 17 Jul 2008 16:32:32 +0400

Marc, Paul,

 

I'm learning your jsr311 and trying to create some kind of inspections for
RESTful apps. I've found some interesting place in your code at page 13.

 

@Path("widgets")

  public class WidgetsResource {

  @GET

  @Path("offers")

  public WidgetList getDiscounted() {...}

 

  @Path("{id}")

  public WidgetResource findWidget(@PathParam("id") String id) {

    return lookupWidget(id);

  }

}

 

In the above a GET request for the widgets/offers resource is handled
directly by the getDiscounted

sub-resource method of the resource class WidgetsResource whereas a GET
request for widgets/xxx

is handled by whatever resource class instance is returned by the findWidget
sub-resource locator (a

WidgetResource).

 

Is it just @GET missed for method findWidget or do you mean that all methods
having @Path will handle GET requests (if none of GET, POST,DELETE,HEAD,PUT
specified) ? I tried to run this code on Jersey and it doesn't work. So, I
think this was just @GET missed.

 

With best regards,

  Konstantin Bulenkov