Question

I am trying add some response headers to some of my webservice calls. I wrote my webservice using CXF 2.1.2 and JAX-RS. I need to return an object and I also want to add some headers to the Response. Without returning a javax.ws.rs.core.Response object, how do I add a header to the response and still return my javabean?

Was it helpful?

Solution

You can inject a reference to the actual HttpServletResponse via the @Context annotation in your webservice and use addHeader() etc. to add your header.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top