users@jersey.java.net

[Jersey] Re: WS itself playing the role of web-client

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 23 Mar 2011 11:46:35 +0100

On 03/23/2011 05:20 AM, Arthur Yeo wrote:
> All,
> In the mix of things, I need one of my WS's to call another WS
> provided by another organization. In other words, my WS is now playing
> the role of a web client.
>
> What's the best way to do this in Jersey?
> Do I just stuff Java client code, like making use of the std URL
> class, in there?
> Or, Is there something else in Jersey you recommend?

former, you need to create Client and WebResource by yourself, there is
nothing better yet (but it might be soon).

you might want to cache created client instance in some singleton,
Client.create() is relatively expensive operation.

Pavel

>
> --
> Arthur Y.