Once the RestEndpointInvocationHandler
has invoked all of the endpoint methods, the CacheResponseFilter
automatically generates HATEOAS links for the response based on the other endpoints available for the resource. It also ensures that any response headers are populated, including the authentication and Etag headers. Once that is done, it releases any acquired locks, unless the lock should be maintained to process sub-resources for the request.
Once the CacheResponseFilter
has finished, the CacheWriterInterceptor
is invoked if the response entity contains a body. It ensures that the writers will only write to a temporary in-memory output stream, allowing the interceptor to modify the response before it is streamed back to the client. It then tells Jersey to invoke the message body writer. On return from the message body writer, it saves state data to the client response stream, if needed for stateless support. This interceptor also sets up a no-cache
header if client side caching should be disabled for the resource. It also creates an Etag for the response. If server-side caching is enabled, the response is saved in a cache and the response is written out to the client output stream.
For additional information, refer to the Working with Caching section.