示例#1
0
  /**
   * Take a Resource that possibly might use URLConnection caching and turn it into one that
   * doesn't.
   *
   * @param resource
   * @return the non-caching resource
   */
  public static Resource getNonCachingResource(Resource resource) {
    if (!(resource instanceof JarFileResource)) return resource;

    JarFileResource oldResource = (JarFileResource) resource;

    JarFileResource newResource = new JarFileResource(oldResource.getURL(), false);
    return newResource;
  }
示例#2
0
  @Test
  public void testJarFileIsContainedIn() throws Exception {
    String s = "jar:" + __userURL + "TestData/test.zip!/subdir/";
    Resource r = Resource.newResource(s);
    Resource container = Resource.newResource(__userURL + "TestData/test.zip");

    assertTrue(r instanceof JarFileResource);
    JarFileResource jarFileResource = (JarFileResource) r;

    assertTrue(jarFileResource.isContainedIn(container));

    container = Resource.newResource(__userURL + "TestData");
    assertFalse(jarFileResource.isContainedIn(container));
  }