If the URL accesses the same resource but the content can be requested in different formats ( json, xml ) via the Content-Type header (as is the case with JAX-RS). How do I generate a cache key that embeds the Content-Type of the response? I guess SimpleCachingHeadersPageCachingFilter will need to be extended to handle this. Are there any examples out there on how to do this?

For example, the first client requests the resource as json and ehcache caches it. However, the second user requests the resource in xml format. However, ehcache does not differentiate between the two and serves the cached json version.

The data is served in XML ( default ) or JSON format based on the access header in the HTTP request ( JAX-RS does the conversion automatically ).

I want to cache the endpoint URLs for the GET requests as building the geolocation data is i/o heavy. However, hacache by default doesn't take the accept header of the request into account and the cache key just uses the request URL.