本文整理汇总了Java中org.springframework.web.servlet.mvc.WebContentInterceptor.setUseCacheControlHeader方法的典型用法代码示例。如果您正苦于以下问题:Java WebContentInterceptor.setUseCacheControlHeader方法的具体用法?Java WebContentInterceptor.setUseCacheControlHeader怎么用?Java WebContentInterceptor.setUseCacheControlHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.mvc.WebContentInterceptor
的用法示例。
在下文中一共展示了WebContentInterceptor.setUseCacheControlHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInterceptors
import org.springframework.web.servlet.mvc.WebContentInterceptor; //导入方法依赖的package包/类
@Override
protected void addInterceptors(InterceptorRegistry registry) {
WebContentInterceptor interceptor = new WebContentInterceptor();
interceptor.setUseCacheControlNoStore(false);
interceptor.setUseCacheControlHeader(false);
//You can add interceptors here
//CommonInterceptor common = new CommonInterceptor();
//registry.addInterceptor(common);
}
示例2: addInterceptors
import org.springframework.web.servlet.mvc.WebContentInterceptor; //导入方法依赖的package包/类
/**
* In Internet Explorer http requests are cached by default. It's a problem when we want to provide a REST API. This interceptor
* adds headers in the responses to desactivate the cache. NB : static resources are cached but managed by the resource handlers
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
WebContentInterceptor interceptor = new WebContentInterceptor();
interceptor.setCacheSeconds(0);
interceptor.setUseExpiresHeader(true);
interceptor.setUseCacheControlHeader(true);
interceptor.setUseCacheControlNoStore(true);
registry.addInterceptor(interceptor);
}
示例3: initWebContentInterceptor
import org.springframework.web.servlet.mvc.WebContentInterceptor; //导入方法依赖的package包/类
@Bean
WebContentInterceptor initWebContentInterceptor() {
WebContentInterceptor webContentInterceptor = new WebContentInterceptor();
webContentInterceptor.setCacheSeconds(0);
webContentInterceptor.setUseCacheControlHeader(true);
return webContentInterceptor;
}
示例4: addInterceptors
import org.springframework.web.servlet.mvc.WebContentInterceptor; //导入方法依赖的package包/类
@Override
public void addInterceptors(InterceptorRegistry registry) {
WebContentInterceptor webContentInterceptor = new WebContentInterceptor();
webContentInterceptor.setCacheSeconds(0);
webContentInterceptor.setUseExpiresHeader(true);
webContentInterceptor.setUseCacheControlHeader(true);
webContentInterceptor.setUseCacheControlNoStore(true);
registry.addInterceptor(new WebContentInterceptor());
}