I found this to achieve this job:
Cache-Control: private The next higher directive is “cache-control:
private”. It instructs proxies in the path not to cache the page. But
it permits browsers to cache the page. Proxies are shared resources
used by multiple users, and this directive tells them not to cache the
response. Browsers, as we have already noted, may still cache the
page.
But how can I add this to request header? These cache issues are relevant with response header. So what should I do to add this parameter to request header?
Thanks.
If you are using Servlets, then you can add / set the required response (not request) HTTP header.
Simple example.
Or you may use
response.addHeader("Cache-Control", "private").It’s just that when using
setHeader(), then if the header had already been set, the new value overwrites the previous one.See Java EE API here:
void addHeader(String name, String value)
void setHeader(String name, String value)