Package org.springframework.core.io

Examples of org.springframework.core.io.ContextResource


   *
   * @see org.osgi.framework.Bundle#getEntry(String)
   * @see org.osgi.framework.Bundle#getResource(String)
   */
  public URL getURL() throws IOException {
    ContextResource res = null;
    URL url = null;

    switch (searchType) {
      // same as bundle space but with a different string
      case OsgiResourceUtils.PREFIX_TYPE_NOT_SPECIFIED:
        res = getResourceFromBundleSpace(pathWithoutPrefix);
        break;
      case OsgiResourceUtils.PREFIX_TYPE_BUNDLE_SPACE:
        res = getResourceFromBundleSpace(pathWithoutPrefix);
        break;
      case OsgiResourceUtils.PREFIX_TYPE_BUNDLE_JAR:
        url = getResourceFromBundleJar(pathWithoutPrefix);
        break;
      case OsgiResourceUtils.PREFIX_TYPE_CLASS_SPACE:
        url = getResourceFromBundleClasspath(pathWithoutPrefix);
        break;
      // fallback
      default:
        // just try to convert it to an URL
        url = new URL(path);
        break;
    }

    if (res != null) {
      url = res.getURL();
    }

    if (url == null) {
      throw new FileNotFoundException(getDescription() + " cannot be resolved to URL because it does not exist");
    }
View Full Code Here


        // 2. locate resource first from the bundle space (since it might not exist)
        OsgiBundleResource entryResource = new OsgiBundleResource(bundle, entry);
        // call the internal method to avoid catching an exception
        URL url = null;
        ContextResource res = entryResource.getResourceFromBundleSpace(entry);
        if (res != null) {
          url = res.getURL();
        }

        if (trace)
          logger.trace("Classpath entry [" + entry + "] resolves to [" + url + "]");
        // we've got a valid entry so let's parse it
View Full Code Here

TOP

Related Classes of org.springframework.core.io.ContextResource

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.