Package org.springframework.web.servlet.resource

Examples of org.springframework.web.servlet.resource.CachingResourceResolver


  }

  public ResourceChainRegistration(boolean cacheResources, Cache cache) {
    Assert.isTrue(!cacheResources || cache != null, "'cache' is required when cacheResources=true");
    if (cacheResources) {
      this.resolvers.add(new CachingResourceResolver(cache));
      this.transformers.add(new CachingResourceTransformer(cache));
    }
  }
View Full Code Here


    assertThat(resolvers, Matchers.hasSize(3));
    assertThat(resolvers.get(0), Matchers.instanceOf(CachingResourceResolver.class));
    assertThat(resolvers.get(1), Matchers.instanceOf(VersionResourceResolver.class));
    assertThat(resolvers.get(2), Matchers.instanceOf(PathResourceResolver.class));

    CachingResourceResolver cachingResolver = (CachingResourceResolver) resolvers.get(0);
    assertThat(cachingResolver.getCache(), Matchers.instanceOf(ConcurrentMapCache.class));
    assertEquals("test-resource-cache", cachingResolver.getCache().getName());

    VersionResourceResolver versionResolver = (VersionResourceResolver) resolvers.get(1);
    assertThat(versionResolver.getStrategyMap().get("/**/*.js"),
        Matchers.instanceOf(FixedVersionStrategy.class));
    assertThat(versionResolver.getStrategyMap().get("/**"),
 
View Full Code Here

    ResourceHttpRequestHandler handler = getHandler("/resources/**");
    List<ResourceResolver> resolvers = handler.getResourceResolvers();
    assertThat(resolvers.toString(), resolvers, Matchers.hasSize(3));
    assertThat(resolvers.get(0), Matchers.instanceOf(CachingResourceResolver.class));
    CachingResourceResolver cachingResolver = (CachingResourceResolver) resolvers.get(0);
    assertThat(cachingResolver.getCache(), Matchers.instanceOf(ConcurrentMapCache.class));
    assertThat(resolvers.get(1), Matchers.equalTo(mockResolver));
    assertThat(resolvers.get(2), Matchers.instanceOf(PathResourceResolver.class));

    List<ResourceTransformer> transformers = handler.getResourceTransformers();
    assertThat(transformers, Matchers.hasSize(2));
View Full Code Here

    assertThat(transformers.get(2), Matchers.instanceOf(AppCacheManifestTransformer.class));
  }

  @Test
  public void resourceChainWithOverrides() throws Exception {
    CachingResourceResolver cachingResolver = Mockito.mock(CachingResourceResolver.class);
    VersionResourceResolver versionResolver = Mockito.mock(VersionResourceResolver.class);
    PathResourceResolver pathResourceResolver = new PathResourceResolver();
    CachingResourceTransformer cachingTransformer = Mockito.mock(CachingResourceTransformer.class);
    AppCacheManifestTransformer appCacheTransformer = Mockito.mock(AppCacheManifestTransformer.class);
    CssLinkResourceTransformer cssLinkTransformer = new CssLinkResourceTransformer();
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.resource.CachingResourceResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.