You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andy McCright (JIRA)" <ji...@apache.org> on 2017/03/02 20:54:45 UTC

[jira] [Comment Edited] (CXF-7262) JAXRS: ClientConfig lost when using templates in the path method

    [ https://issues.apache.org/jira/browse/CXF-7262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15892958#comment-15892958 ] 

Andy McCright edited comment on CXF-7262 at 3/2/17 8:54 PM:
------------------------------------------------------------

Good catch Sergey!  I missed the scenario where the initial WebClient was null.  This would be the case when the unresolved template is part of the initial target() call.  I've updated my patch with a fix that keeps the targetClient field null if it was previously null, but preserves it in all other cases - preserving the config.  That passes the original test and yours (which I added to the new test class).

Thanks, Andy


was (Author: andymc):
Good catch Sergey!  I missed the scenario where the initial WebClient was null.  This would be the case when the unresolved template is part of the initial target() call.  I'll update my patch with a fix shortly.

Thanks, Andy

> JAXRS: ClientConfig lost when using templates in the path method
> ----------------------------------------------------------------
>
>                 Key: CXF-7262
>                 URL: https://issues.apache.org/jira/browse/CXF-7262
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.8
>            Reporter: Andy McCright
>
> The ClientConfiguration (not to be confused with the JAXRS Configuration) is lost when a user of the JAXRS Client APIs calls path(...) on a WebTarget with a template.  The ClientConfiguration contains important pieces like Interceptors, etc. that would be lost when the user tries to invoke the method on the WebTarget returned from the path(...) method.
> For example, we create an out interceptor and add it to the ClientConfiguration, and we would expect that interceptor to be executed on every outbound request, but the following example shows that it is not:
> Client client = ClientBuilder.newClient();
> WebTarget target = client.target("http://localhost:8080/myRoot");
> target.request().get(); // works - invokes the interceptor
> WebTarget target2 = target.path("/path/{key}").resolveTemplate("key", "value");
> target2.request().get(); // fails - request is sent without invoking the interceptor



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)