Is there a spring 3.1 MVC annotation to disable browser response caching?

Is there any annotation in SpringMVC 3.1 to disable browser caching using the MVC controller method?

@Controller @RequestMapping("/status") public class StatusController { @RequestMapping(method=RequestMethod.GET) //anyway to have an annotation here that turns of all the http caching headers? public String get() { // do some work here return "status"; } } 
+4
source share
1 answer

As far as I can tell, there is no annotation, but there is a way to configure it via XML using an interceptor. For instance:

 <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/status"/> <bean id="noCacheWebContentInterceptor" class="com.nyx.spring.mvc.WebContentInterceptor"> <property name="cacheSeconds" value="0"/> <property name="useExpiresHeader" value="true"/> <property name="useCacheControlHeader" value="true"/> <property name="useCacheControlNoStore" value="true"/> </bean> </mvc:interceptor> </mvc:interceptors> 
+2
source

Source: https://habr.com/ru/post/1392170/


All Articles