cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7262) JAXRS: ClientConfig lost when using templates in the path method
Date Thu, 02 Mar 2017 13:03:45 GMT

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

Sergey Beryozkin commented on CXF-7262:
---------------------------------------

Hi Andy, good to see you submitting another patch :-).
FYI, I'm getting NPE with this patch if I initialize a Client with a URI already containing
the templates:

{code:java}
@Test
    public void testGetBookSpecTemplate() {
        String address = "http://localhost:" + PORT + "/bookstore/{a}/simple";
        Client client = ClientBuilder.newClient();
        WebTarget webTarget = client.target(address)
            .resolveTemplate("a", "bookheaders");
        // NPE
        Invocation.Builder builder = webTarget.request("application/xml").header("a", new
BType());

        Response r = builder.get();
        Book book = r.readEntity(Book.class);
        assertEquals(124L, book.getId());
        assertEquals("b", r.getHeaderString("a"));
    }
{code} 

I wonder if we should keep a complete check but pass a 'targetClient' in the non-complete
branch

Can you experiment please ?
thanks

> 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)

Mime
View raw message