I am using JAXRSClientFactoryBean to programmatically create my JAXRS client
and want to get the Content-Disposition HTTP header from the response when I
invoke a method on the client.
I am programmatically creating my JAXRS client as follows:
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setServiceClass(Wcs.class);
bean.setAddress("http://my.site.com/myservice");
MyInterface proxy = bean.create(MyInterface.class);
The implementation of MyInterface has this method:
@Override
@POST
@Consumes({"text/xml", "application/xml"})
public InputStream getCoverage(GetCoverage request) throws WcsException
{
InputStream is = proxy.getCoverage(request);
if (httpServletResponse != null) {
String contentDisposition =
httpServletResponse.getHeader("Content-Disposition");
}
return is;
}
I have tried injecting HttpServletResponse using @Context and I have tried
injecting MessgageContext using @Context (both in a declaration and with a
setter method like so:
@Context
public void setHttpServletResponse(HttpServletResponse
httpServletResponse) {
LOGGER.debug("Setting HttpServletResponse");
this.httpServletResponse = httpServletResponse;
}
The context is never injected, it is always null. I verified with a debugger
that the setter method was not called.
What might I be doing wrong? I am using CXF version 2.7.5
Thanks.
Hugh
--
View this message in context:
http://cxf.547215.n5.nabble.com/How-to-get-HTTP-response-headers-when-using-JAXRSClientFactoryBean-to-create-JAXRS-Client-tp5732047.html
Sent from the cxf-user mailing list archive at Nabble.com.