how to set header no cache in spring mvc 3 by annotation? not is
response.setHeader(\"Pragma\",\"No-cache\");
response.setHeader(\"Cache-Control\",
There is no such option. You can use an interceptor:
(taken from here)
On one hand it is logical not to have such annotation. Annotations on spring-mvc methods are primarily to let the container decide which method to invoke (limiting it by a request header, request url, or method). Controlling the response does not fall into this category.
On the other hand - yes, it will be handy to have these, because when controllers are unit-tested it is not relevant to test http header stuff (or is it?). And there are @ResponseBody and @ResponseStatus, which do specify some response properties.