Package org.springframework.core.io.support

Examples of org.springframework.core.io.support.ResourcePatternResolver


    System.out.println("classpath*:root.file resources");
    printPathWithinContext(res);
  }

  public void testNoRootCpBundleResourceInClassPathFound() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath*:cp.file");
    assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));
    assertTrue("resource should be found since it's on the classpath", res[0].exists());
    System.out.println("classpath*:cp.file resources");
    printPathWithinContext(res);
  }
View Full Code Here


    System.out.println("classpath*:cp.file resources");
    printPathWithinContext(res);
  }

  public void testNoRootCpBundleResourceNestedInClassPathFound() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath*:/some/nested/nested.file");
    assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));
    assertTrue("resource should be found since it's on the classpath", res[0].exists());
    System.out.println("classpath*:/some/nested/nested.file resources");
    printPathWithinContext(res);
  }
View Full Code Here

    System.out.println("classpath*:/some/nested/nested.file resources");
    printPathWithinContext(res);
  }

  public void testNoRootCpBundleResourceNestedInPkgInClassPathFound() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath*:/some/nested/pkg/pkg.file");
    assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));
    assertTrue("resource should be found since it's on the classpath", res[0].exists());
  }
View Full Code Here

    assertFalse("resource should be found since it's on the classpath", ObjectUtils.isEmpty(res));
    assertTrue("resource should be found since it's on the classpath", res[0].exists());
  }

  public void testNoRootCpBundleResourcePatternMatching() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath:/**/*.file");
    assertEquals("incorrect number of resources found", 3, res.length);
  }
View Full Code Here

    Resource[] res = resolver.getResources("classpath:/**/*.file");
    assertEquals("incorrect number of resources found", 3, res.length);
  }

  public void testNoRootCpBundleResourceMultipleRoots() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath*:/**/*.file");
    assertEquals("incorrect number of resources found", 3, res.length);
  }
View Full Code Here

    Resource[] res = resolver.getResources("classpath*:/**/*.file");
    assertEquals("incorrect number of resources found", 3, res.length);
  }

  public void testNoRootCpBundleResourcePatternMatchingWithSpecifiedFolder() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath:/some/**/*.file");
    assertEquals("incorrect number of resources found", 2, res.length);
  }
View Full Code Here

    Resource[] res = resolver.getResources("classpath:/some/**/*.file");
    assertEquals("incorrect number of resources found", 2, res.length);
  }

  public void testNoRootCpBundleResourceMultipleRootsSpecifiedFolder() throws Exception {
    ResourcePatternResolver resolver = getNoRootCpBundleResourceResolver();
    Resource[] res = resolver.getResources("classpath*:/some/**/*.file");
    assertEquals("incorrect number of resources found", 2, res.length);
  }
View Full Code Here

   * @param bundle
   * @return
   * @throws Exception
   */
  private static Resource[] getBundleTagLibs(Bundle bundle) throws IOException {
    ResourcePatternResolver resolver = new OsgiBundleResourcePatternResolver(bundle);
    return resolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + META_INF + "/**/" + TLD_PATTERN);
  }
View Full Code Here

            // Add mapping locations
            PropertyValue mappingLocationsProp = properties.getPropertyValue("mappingLocations");
            if (mappingLocationsProp != null) {
                List<TypedStringValue> mappingLocations = (List<TypedStringValue>) mappingLocationsProp.getValue();
                if (mappingLocations != null) {
                    ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
                    for (TypedStringValue mappingLocation : mappingLocations) {
                        LOG.info("Found mappingLocation " + mappingLocation.getValue());
                        Resource[] resources = resourcePatternResolver.getResources(mappingLocation.getValue());
                        for (int i = 0; i < resources.length; i++) {
                            LOG.info("Adding resource  " + resources[i].getURL());
                            try {
                                DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                                // Disable DTD resolution
View Full Code Here

            logger.debug("[applicationContext] iterates the 'findFiles'"
                    + " classes folders or jar files; size=" + resources.size());
        }

        List<Resource> ctxResources = new LinkedList<Resource>();
        ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
        int index = 0;
        for (ResourceRef ref : resources) {
            index++;
            if (ref.hasModifier("applicationContext")) {
                Resource[] founds = ref.getInnerResources(resourcePatternResolver,
View Full Code Here

TOP

Related Classes of org.springframework.core.io.support.ResourcePatternResolver

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.