[jax-rs-spec users] [jsr339-experts] Re: Questions about WebTarget

From: Marek Potociar <>
Date: Wed, 17 Jul 2013 15:43:28 +0200

On Jul 17, 2013, at 1:31 PM, Sergey Beryozkin <> wrote:

> Hi
> I'd like to ask a couple of questions about WebTarget interface [1].
> 1. Methods matrixParam(), queryParam(), path(), all of resolveTemplate methods create a new WebTarget instance, does a state of the current WebTarget's URIBuilder gets affected or is it cloned first ?

The URIBuilder needs to be cloned first. State of the parent target should not be affected.

> 2. Configuration inheritance (I guess it applies to the whole ClientBuilder -> Client -> WebTarget chain).
> Suppose I have WebTarget1 which creates a new WebTarget2. WebTarget1 has a configuration property "target1". WebTarget2 gets a snapshot of the WebTarget1's configuration, what happens when a property such as "target1" gets removed on WebTarget2's Configuration - is it just removed (no side-effect I guess for WebTarget1) or should it be IllegalStateException ?

The change in the child component config must not have any side effects on the parent component config. Once the child component is created, the child configuration is copied and decoupled from the parent (effectively, implementations may of course optimize this).


> Thanks, Sergey
> [1]