users@jersey.java.net

[Jersey] Re: Creating a new WebTarget from an existing one

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Wed, 16 Apr 2014 15:23:19 -0700

Not sure what a WebResource is in 2.0 but isn't what you want to do as
simple as:

     client.target( response.getLocation() );

Or something equally simple? if it's relative you can use your existing
target and just do something like:

    target.path( relPath );




On Wed, Apr 16, 2014 at 3:13 PM, cowwoc <cowwoc_at_bbs.darktech.org> wrote:

> Hi,
>
> In Jersey 1.0 we could create one WebResource from another as follows:
>
> WebResource first = ...;
> WebResource second = first.uri(newAddress);
>
> Naturally, when a resource returns a link we want to construct a new
> resource using the new link using the same Client. By removing support for
> this very common use-case, you are forcing users to re-implement this
> themselves over and over again in their code.
>
> Why was this use-case removed in Jersey 2.0?
>
> Thanks,
> Gili
>