Package java.net

Examples of java.net.URLStreamHandler


    }
  }

  private StreamHandlerFactory() {
    for (String protocol : Arrays.asList("http", "https")) {
      URLStreamHandler fallbackHandler = getFallbackStreamHandler(protocol);
      handlers.put(protocol, new LocalURLFetchServiceStreamHandler(fallbackHandler));
    }
  }
View Full Code Here


   */
  private static URLStreamHandler getFallbackStreamHandler(String protocol) {
    if (GET_URL_STREAM_HANDLER == null) {
      return null;
    }
    URLStreamHandler existingHandler =
        (URLStreamHandler) invoke(null, GET_URL_STREAM_HANDLER, protocol);
    if (existingHandler.getClass().getName().equals(
            LocalURLFetchServiceStreamHandler.class.getName())) {
      Method getFallbackHandler =
          getDeclaredMethod(existingHandler.getClass(), "getFallbackHandler");
      return (URLStreamHandler) invoke(existingHandler, getFallbackHandler);
    }
    return existingHandler;
  }
View Full Code Here

    private void assertDocumentHasXml(String expectedXML, Document document) {
        assertEquals(expectedXML, XmlUtility.asString(document.getRootElement()));
    }

    private URL createURL(final String xml, final int byteCount) throws MalformedURLException {
        return new URL("http", "www.example.com", 8080, "foo", new URLStreamHandler() {
            protected URLConnection openConnection(URL u) {
                return new URLConnection(u) {
                    public void connect() {
                    }
View Full Code Here

        @aribaapi documented
    */
    public static URL makeURL (String protocol, String host, int port, String file)
      throws MalformedURLException
    {
        URLStreamHandler handler = null;
        if (HTTP.SecureProtocol.equalsIgnoreCase(protocol)) {
            handler = getHttpsURLStreamHandler();
        }
        return new URL(protocol, host, port, file, handler); // OK
    }
View Full Code Here

            // Otherwise, we will let java take care of the handler unless
            // the spec protocol is not specified (i.e. null).
            // Then we determine the protocol from the context, and pass in
            // our handler if the context protocol is https.

        URLStreamHandler handler = null;
        if (spec == null) {
            if (context != null) {
                if (HTTP.SecureProtocol.equalsIgnoreCase(context.getProtocol())) {
                    handler = getHttpsURLStreamHandler();
                }
View Full Code Here

        if (debug >= 1)
            log("addRepository(" + repository + ")");

        // Add this repository to our underlying class loader
        try {
            URLStreamHandler streamHandler = null;
            String protocol = parseProtocol(repository);
            if (factory != null)
                streamHandler = factory.createURLStreamHandler(protocol);
            URL url = new URL(null, repository, streamHandler);
            super.addURL(url);
View Full Code Here

     * @exception IllegalArgumentException if the manifest of a JAR file
     *  cannot be processed correctly
     */
    protected void addRepositoryInternal(String repository) {

        URLStreamHandler streamHandler = null;
        String protocol = parseProtocol(repository);
        if (factory != null)
            streamHandler = factory.createURLStreamHandler(protocol);

        // Validate the manifest of a JAR file repository
View Full Code Here

     * @param factory Handler factory to use to generate the URLs
     */
    protected static URL[] convert(String input[],
                                   URLStreamHandlerFactory factory) {

        URLStreamHandler streamHandler = null;

        URL url[] = new URL[input.length];
        for (int i = 0; i < url.length; i++) {
            try {
                String protocol = parseProtocol(input[i]);
View Full Code Here

        if (debug >= 1)
            log("addRepository(" + repository + ")");

        // Add this repository to our underlying class loader
        try {
            URLStreamHandler streamHandler = null;
            String protocol = parseProtocol(repository);
            if (factory != null)
                streamHandler = factory.createURLStreamHandler(protocol);
            URL url = new URL(null, repository, streamHandler);
            super.addURL(url);
View Full Code Here

     * @exception IllegalArgumentException if the manifest of a JAR file
     *  cannot be processed correctly
     */
    protected void addRepositoryInternal(String repository) {

        URLStreamHandler streamHandler = null;
        String protocol = parseProtocol(repository);
        if (factory != null)
            streamHandler = factory.createURLStreamHandler(protocol);

        // Validate the manifest of a JAR file repository
View Full Code Here

TOP

Related Classes of java.net.URLStreamHandler

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.