jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Some comments about Target and Invocation

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Thu, 1 Sep 2011 12:10:00 +0100

>>
>> int[] bookIndexesToRetrieve = ...;
>> Target booksResource = client.target("http://books/");
>> List<Book> books = new ArrayList(bookIndexesToRetrieve.length);
>> for (int bookIndex : bookIndexesToRetrieve) {
>> books.add(booksResource.path(String.valueOf(bookIndex)).request("text/plain").get(Book.class));
>>
>> }
>
> Won't the above result in "http://books/1/2/3/4" say after 4 iterations
> ? I'm presuming that target.path() is accumulative, that is calling
> target.path("1") is equivalent to

meant to say calling 'target.path("1") 4 times'

> target.path("1").path("1").path("1").path("1") ?