Java 类org.springframework.web.servlet.mvc.WebContentInterceptor 实例源码

项目:j2ts    文件:Config.java   
@Override
public void addInterceptors(InterceptorRegistry registry) {

    //
    // レスポンスのキャッシュを制御する Interceptor
    //
    val interceptor = new WebContentInterceptor();
    interceptor.setCacheSeconds(0);
    interceptor.setUseExpiresHeader(true);
    interceptor.setUseCacheControlHeader(true);
    interceptor.setUseCacheControlNoStore(true);
    val cacheMappings = new Properties();
    // cache for one month
    cacheMappings.put("/assets/**", "2592000"); // TODO
                                                // local環境だけキャッシュしないとか分岐が必要
    cacheMappings.put("/webjars/**", "2592000");
    interceptor.setCacheMappings(cacheMappings);
    registry.addInterceptor(interceptor);
}
项目:BasicSpringMVC    文件:WebConfig.java   
@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);
}
项目:cas-5.1.0    文件:CasSecurityContextConfiguration.java   
@Bean
public WebContentInterceptor webContentInterceptor() {
    final WebContentInterceptor interceptor = new WebContentInterceptor();
    interceptor.setCacheSeconds(0);
    interceptor.setAlwaysUseFullPath(true);
    return interceptor;
}
项目:bonita-ui-designer    文件:WebMvcConfiguration.java   
/**
 * 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);
}
项目:onboard    文件:WebConfig.java   
@Bean
WebContentInterceptor initWebContentInterceptor() {
    WebContentInterceptor webContentInterceptor = new WebContentInterceptor();
    webContentInterceptor.setCacheSeconds(0);
    webContentInterceptor.setUseCacheControlHeader(true);
    return webContentInterceptor;
}
项目:cross-preferences    文件:Config.java   
@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());
}
项目:InSpider    文件:AdminWebMvcConfig.java   
public @Bean WebContentInterceptor webContentInterceptor () {
    if (this.webContentInterceptor == null) {
        this.webContentInterceptor = new WebContentInterceptor ();

        this.webContentInterceptor.setAlwaysUseFullPath (true);
        this.webContentInterceptor.setCacheSeconds (0);

        this.webContentInterceptor.setCacheMappings (new Properties () {
            private static final long serialVersionUID = 1L;

            {
                put ("/styles/**", "86400");
                put ("/scripts/**", "86400");
                put ("/images/**", "86400");
            }
        });
    }

    return this.webContentInterceptor;
}
项目:parkandrideAPI    文件:Application.java   
@Override
public void addInterceptors(InterceptorRegistry registry) {
    WebContentInterceptor webContentInterceptor = new WebContentInterceptor();
    Properties cacheMappings = new Properties();
    cacheMappings.setProperty(UrlSchema.API + "/**", "0");
    webContentInterceptor.setCacheMappings(cacheMappings);
    registry.addInterceptor(webContentInterceptor);
}
项目:servlet4-demo    文件:ApplicationConfig.java   
@Override
public void addInterceptors(InterceptorRegistry registry) {
  WebContentInterceptor interceptor = new WebContentInterceptor();
  interceptor.addCacheMapping(CacheControl.maxAge(365, TimeUnit.DAYS), "/**");
  registry.addInterceptor(interceptor);
}
项目:servlet4-demo    文件:ApplicationConfigTest.java   
@Test
public void testAddInterceptors() {
  sut.addInterceptors(registry);
  verify(registry, times(1)).addInterceptor(any(WebContentInterceptor.class));
}