Hi
On 26/01/15 12:10, Veit Guna wrote:
Hi.
Is it expected behavior, that after a JAX-RS client proxy request has been
made, accessing the response via converted WebClient returns null?
My code:
Client client = WebClient.client(clientProxy);
System.out.println("client response: " + client.getResponse());
WebClient webClient = WebClient.fromClient(client);
System.out.println("webclient response. " + webClient.getResponse());
Outputs:
client response: org.apache.cxf.jaxrs.impl.ResponseImpl@20e14502
webclient response. null
IMHO it is reasonable. During the conversion only those properties are
copied that are needed for the subsequent invocations.
I also encountered, that after an entity has been returned by the client proxy
invocation, accessing the response stream via Client returns an empty stream.
Using:
InputStream inputStream = response.readEntity(InputStream.class);
I figured out, that enabling client response buffering does the trick in this
case:
WebClient.getConfig(store).getResponseContext().put("buffer.proxy.response",
"true");
But I'm wondering, if that is the right usage of the "user" client API. Since
the constant belonging to that property key is private
in ClientProxyImpl (BUFFER_PROXY_RESPONSE).
JAX-RS Response has a standard method for buffering but in case of the
CXF proxy API, yes, this property needs to be set if the buffering is
required. I'll update the wiki docs...
Cheers, Sergey
I'm using CXF 3.0.4-SNAPSHOT.
Thanks.
Veit