users@jsr311.java.net

Re: UriInfo.getAncestorResources

From: Sergey Beryozkin <sergey.beryozkin_at_iona.com>
Date: Wed, 18 Jun 2008 15:05:42 +0100

Hi Stephan

I'm still a bit unclear about it.

@Path("/")
class Foo {

   
    @GET
    public Bar get(@Context UriInfo) {}
    
    @Path("/bar")
    public Bar sublocator(@Context UriInfo) {}
    
}

When injected through get() the list is empty, when injected through sublocator() the list is 1, when will the list be longer ?

Thanks, Sergey
  ----- Original Message -----
  From: Stephan Koops
  To: users_at_jsr311.dev.java.net
  Sent: Wednesday, June 18, 2008 2:59 PM
  Subject: Re: UriInfo.getAncestorResources


  Hi Sergey, hi Marc,

    I don't understand the purpose of UriInfo.getAncestorResources().
    In other words, it seems like that the returned list can have a maximum size of 1, given that
    according the spec only classes created by the JAX-RS runtime can be injected with @Context annotated values, such as
    UriInfo instance.
  This method returns the resource class instances. If you used sub resource locators, the list could be longer.

  Marc, you should change the example (especially the last paragraph), and including a sub resource class.

  best regards
     Stephan

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland