Setting Cache-Control headers with Resteasy

Solution Unverified - Updated -

Issue

We have been using org.jboss.resteasy.annotations.cache.NoCache annotation to disable caching for annotated resteasy endpoints. Our security group has suggested that we specify:

Cache-Control: no-cache, no-store
Expires: 0
Pragma: no-cache

NoCache does not allow any arguments, and the other option appears to be org.jboss.resteasy.annotations.cache.Cache which does appear to offer support for no-store.
1. Do we need to use @Cache and @NoCache together to get Cache-Control: no-cache, no-store ? These seem contrary, conflicting, and not at all intuitive.
2. What is the recommended way to accomplish all three of the above headers on a resteasy endpoint?

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content