On 09/07/2014 10:45, Francesco Chicchiriccò wrote:
iI all,
this snippet

WebClient client = ...;
Response response = client.invoke(method, inputStream);
response.getEntity();

fails with

java.lang.IllegalStateException: Entity is not available
at org.apache.cxf.jaxrs.impl.ResponseImpl.checkEntityIsClosed(ResponseImpl.java:475) at org.apache.cxf.jaxrs.impl.ResponseImpl.getActualEntity(ResponseImpl.java:137) at org.apache.cxf.jaxrs.impl.ResponseImpl.getEntity(ResponseImpl.java:142)

I am using CXF 3.0.0 (the same code works fine with CXF 2.7.11): any idea?

It seems I've over-simplified the snippet above: it should have been, actually

WebClient client = ...;
Response response = client.invoke(method, inputStream);
client.close();
response.getEntity();

It seems that with CXF 3.0.0 closing a client implies also closing the response object, thus causing the exception above: correct?

Regards.

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/

Reply via email to