Java Code Examples for sun.net.util.URLUtil#urlNoFragString()

The following examples show how to use sun.net.util.URLUtil#urlNoFragString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeSource.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a CodeSource and associates it with the specified
 * location and set of certificates.
 *
 * @param url the location (URL).  It may be {@code null}.
 * @param certs the certificate(s). It may be {@code null}. The contents
 * of the array are copied to protect against subsequent modification.
 */
public CodeSource(URL url, java.security.cert.Certificate[] certs) {
    this.location = url;
    if (url != null) {
        this.locationNoFragString = URLUtil.urlNoFragString(url);
    }

    // Copy the supplied certs
    if (certs != null) {
        this.certs = certs.clone();
    }
}
 
Example 2
Source File: CodeSource.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a CodeSource and associates it with the specified
 * location and set of code signers.
 *
 * @param url the location (URL).  It may be {@code null}.
 * @param signers the code signers. It may be {@code null}. The contents
 * of the array are copied to protect against subsequent modification.
 *
 * @since 1.5
 */
public CodeSource(URL url, CodeSigner[] signers) {
    this.location = url;
    if (url != null) {
        this.locationNoFragString = URLUtil.urlNoFragString(url);
    }

    // Copy the supplied signers
    if (signers != null) {
        this.signers = signers.clone();
    }
}
 
Example 3
Source File: CodeSource.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a CodeSource and associates it with the specified
 * location and set of certificates.
 *
 * @param url the location (URL).  It may be {@code null}.
 * @param certs the certificate(s). It may be {@code null}. The contents
 * of the array are copied to protect against subsequent modification.
 */
public CodeSource(URL url, java.security.cert.Certificate[] certs) {
    this.location = url;
    if (url != null) {
        this.locationNoFragString = URLUtil.urlNoFragString(url);
    }

    // Copy the supplied certs
    if (certs != null) {
        this.certs = certs.clone();
    }
}
 
Example 4
Source File: CodeSource.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a CodeSource and associates it with the specified
 * location and set of code signers.
 *
 * @param url the location (URL).  It may be {@code null}.
 * @param signers the code signers. It may be {@code null}. The contents
 * of the array are copied to protect against subsequent modification.
 *
 * @since 1.5
 */
public CodeSource(URL url, CodeSigner[] signers) {
    this.location = url;
    if (url != null) {
        this.locationNoFragString = URLUtil.urlNoFragString(url);
    }

    // Copy the supplied signers
    if (signers != null) {
        this.signers = signers.clone();
    }
}
 
Example 5
Source File: URLClassPath.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private synchronized Loader getLoader(int index) {
    if (closed) {
        return null;
    }
    // Expand URL search path until the request can be satisfied
    // or unopenedUrls is exhausted.
    while (loaders.size() < index + 1) {
        final URL url;
        synchronized (unopenedUrls) {
            url = unopenedUrls.pollFirst();
            if (url == null)
                return null;
        }
        // Skip this URL if it already has a Loader. (Loader
        // may be null in the case where URL has not been opened
        // but is referenced by a JAR index.)
        String urlNoFragString = URLUtil.urlNoFragString(url);
        if (lmap.containsKey(urlNoFragString)) {
            continue;
        }
        // Otherwise, create a new Loader for the URL.
        Loader loader;
        try {
            loader = getLoader(url);
            // If the loader defines a local class path then add the
            // URLs as the next URLs to be opened.
            URL[] urls = loader.getClassPath();
            if (urls != null) {
                push(urls);
            }
        } catch (IOException e) {
            // Silently ignore for now...
            continue;
        } catch (SecurityException se) {
            // Always silently ignore. The context, if there is one, that
            // this URLClassPath was given during construction will never
            // have permission to access the URL.
            if (DEBUG) {
                System.err.println("Failed to access " + url + ", " + se );
            }
            continue;
        }
        // Finally, add the Loader to the search path.
        loaders.add(loader);
        lmap.put(urlNoFragString, loader);
    }
    return loaders.get(index);
}
 
Example 6
Source File: JarFileFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private String urlKey(URL url) {
    String urlstr =  URLUtil.urlNoFragString(url);
    if ("runtime".equals(url.getRef())) urlstr += "#runtime";
    return urlstr;
}
 
Example 7
Source File: JarFileFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private String urlKey(URL url) {
    String urlstr =  URLUtil.urlNoFragString(url);
    if ("runtime".equals(url.getRef())) urlstr += "#runtime";
    return urlstr;
}