Hi Delphine,
It is recommend that you reuse Client instances (for approach sets of
configuration) as these are expensive to create.
A WebResource is a lot cheaper to create than a Client.
WebResource is thread safe when building requests, sending them and
receiving responses. WebResource is not thread safe if filters are
added/removed. In hindsight i should have made WebResource completely
immutable and instead filters are added using a builder pattern.
Reusing a WebResource is often a useful concept, especially if you
want to create sub-resources.
Paul.
On Aug 20, 2009, at 10:51 AM, Delphine Garcia wrote:
> Hi,
>
> I'm a new Jersey developper and I have some questions about
> WebResource utilisation on the client side.
>
> What is the best practice : Use one instance of WebResource or use a
> new instance for each call ?
> Could the instance be static and so is there any problem with a
> multi threaded client ?
>
> Thank you for your help.
>
> Delphine Garcia
> Air France
>