Hi Thorsten
On 06/02/14 06:13, Thorsten Höger wrote:
Hi,

I have a problem using the JAXRSClient with response headers. If the
return value is of type javax.ws.rs.core.Response the returned instance
does not contain response headers in some cases.

I set up a test branch on github under
https://github.com/hoegertn/cxf-spring-aop

This repo contains a branch "responseHeader" which has unit tests to
show the problem.

To run this project start de.hoegertn.Starter as Java Application and
then launch de.hoegertn.TestHeaders as JUnit-Test.

Both tests should print out the response headers received from the API.
But only the response containing a body has headers set on the client-side.
I think the problem occurs in org.apache.cxf.jaxrs.client.AbstractClient:366

Am I doing something wrong when creating the JAXRSClient or is this a bug?

You have the server returning 202 accepted and HttpConduit treats the case with 202 and no body, when no async mode is enabled, specifically and does not initiates the client message observer, but also losing the in message which contains HTTP response headers.

I think, for now, we can do a minor fix in HttpConduit to ensure that the response message is attached to the exchange in such a rare case - the headers should be visible to the receivers such as an RS client expecting the untyped Response.

I'm not sure about running the client observer in this case though, might optionally be done (example, by having a property set) if needed in the future

See
https://issues.apache.org/jira/browse/CXF-5547

Thanks, Sergey


Regards,
Thorsten



Reply via email to