Re: Misprint or what? (JSR311 June 27, 2008)

  • From: Stephan Koops <Stephan.Koops@...>
  • To: users@...
  • Subject: Re: Misprint or what? (JSR311 June 27, 2008)
  • Date: Fri, 18 Jul 2008 11:49:25 +0200
  • Mailing-list: contact users-help@...; run by ezmlm

Hi Konstantin,

the WidgetResource returned by findWidget(.) is a resource class, which also contains (sub) resource methods, e.g.:

public class WidgetResource {
   /** contains the id of the widget */
   private int id;

   @GET
   public Object get() { ... }
}

Is it now clearer what is meant?

Marc, perhaps you could add an exmaple WidgetResource class to the spec. This makes it clearer, and a reader see at a glance what is meant.

best regards
   Stephan

Konstantin Bulenkov schrieb:

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



Misprint or what? (JSR311 June 27, 2008)

Konstantin Bulenkov 07/17/2008

Re: Misprint or what? (JSR311 June 27, 2008)

Stephan Koops 07/18/2008
Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150626.29986a4)
 
 
Close
loading
Please Confirm
Close