Reputation: 407
I'm writing a fairly generic webapp that I want to be JAX-RS "pure", though I'm developing using Jetty and CXF. I want to do something extremely simple, I want for ALL HTTP responses a header added (not just for the methods I'm writing code for, even auto-handled 415 responses).
Solutions for How do i modify HTTP headers for a JAX-WS response in CXF? seem overly complex (and specific for CXF's implementations of JAX-RS)for just needing to add: MyServerVersion : 1.0 to every response.
Upvotes: 1
Views: 461
Reputation: 407
Thanks for answer above, I summarized what I did in a blog post and it gives some background and context for the Accept-Post
response header I was working with and code samples.
Upvotes: 0
Reputation: 11984
The standard way to do this is with a ContainerResponseFilter
. See Chapter 6: Filters and Interceptors of the JAX-RS specification.
You'll want to add your header to ContainerResponseContext#getHeaders()
. See this question for an example.
Upvotes: 1