Sure, it should actually work for JAXWS services too...Or doing the same in the
CXF custom out interceptor (MARSHAL phase for ex)
That said, few more options are available at the (CXF) JAX-RS level :
- register a custom ResponseHandler filer and override the JAXRS Response by adding a Cache-Control header to the original Response,
using a JAXRS CacheControl utility
- return JAXRS Response directly from all your methods and set that header
there, but it might be more intrusive
Sergey
----- Original Message -----
From: "KARR, DAVID (ATTCINW)" <[email protected]>
To: <[email protected]>; <[email protected]>
Sent: Wednesday, November 18, 2009 5:17 PM
Subject: RE: JAX-RS and cache-control
-----Original Message-----
From: Benson Margulies [mailto:[email protected]]
Sent: Wednesday, November 18, 2009 9:10 AM
To: [email protected]
Subject: JAX-RS and cache-control
Can someone give me a recipe to add cache control headers to ALL
responses
from my JAX-RS service?
You should be able to implement a servlet filter that adds response headers for cache control. In fact, several people on the
internet have done exactly that. Here's an example:
<http://www.digitalsanctuary.com/tech-blog/java/jboss/setting-cache-headers-from-jboss.html>.