Package java.net

Examples of java.net.URLStreamHandler


    private static final Map m_handlerToURL = new HashMap();
    private void init(String protocol, URLStreamHandlerFactory factory)
    {
        try
        {
            URLStreamHandler handler = getBuiltInStreamHandler(protocol, factory);
            if (handler != null)
            {
                URL url = new URL(protocol, null, -1, "", handler);
                m_handlerToURL.put(handler, url);
            }
View Full Code Here


                return (URLStreamHandler) m_builtIn.get(protocol);
            }
        }
        if (factory != null)
        {
            URLStreamHandler result = factory.createURLStreamHandler(protocol);
            if (result != null)
            {
                return addToCache(protocol, result);
            }
        }
        // Check for built-in handlers for the mime type.
        // Iterate over built-in packages.
        URLStreamHandler handler = loadBuiltInStreamHandler(protocol, null);
        if (handler == null)
        {
            handler = loadBuiltInStreamHandler(protocol, ClassLoader.getSystemClassLoader());
        }
        return addToCache(protocol, handler);
View Full Code Here

        // IMPLEMENTATION NOTE: Caching is not strictly necessary for
        // stream handlers since the Java runtime caches them. Caching is
        // performed for code consistency between stream and content
        // handlers and also because caching behavior may not be guaranteed
        // across different JRE implementations.
        URLStreamHandler handler = getFromStreamCache(protocol);

        if (handler != null)
        {
            return handler;
        }
View Full Code Here

    };
   
    private ClassLoader mockClassLoader(String ... paths) throws MalformedURLException, IOException {
        final ClassLoader cl = Mockito.mock(ClassLoader.class);
        final JarURLConnection conn = Mockito.mock(JarURLConnection.class);
        final URLStreamHandler handler = new URLStreamHandler() {
            @Override
            protected URLConnection openConnection(final URL url) throws IOException {
                if(throwExceptionOnOpenConnection) {
                    throw new IOException("Throwing up for testing that");
                }
View Full Code Here

    public static void setHandlerPackage(String handlerPackage) {
        WonderlandURLStreamHandlerFactory.handlerPackage = handlerPackage;
    }
   
    public URLStreamHandler createURLStreamHandler(String protocol) {
        URLStreamHandler u = null;


        // hardcode the list of protocol handelers.  We do this because
        // trying to load a handler class that doesn't exist using
        // Class.forName() throws a ClassCircularityError.
View Full Code Here

        return connection;
    }

    public static ConnectionFactoryImpl createFromURL(final String urlString) throws MalformedURLException
    {
        URL url = new URL(null, urlString, new URLStreamHandler()
                    {
                        @Override
                        protected URLConnection openConnection(URL u) throws IOException
                        {
                            throw new UnsupportedOperationException();
View Full Code Here

      for(final Map.Entry<ArchivePath, Node> entry : classes.entrySet())
      {
         try
         {
            beanClasses.add(
                  new URL(null, "archive://" + entry.getKey().get(), new URLStreamHandler()
                  {
                     @Override
                     protected java.net.URLConnection openConnection(URL u) throws java.io.IOException
                     {
                        return new URLConnection(u)
View Full Code Here

      for (final Map.Entry<ArchivePath, Node> entry : beansXmls.entrySet())
      {
         try
         {
            addWebBeansXmlLocation(
                  new URL(null, "archive:/" + entry.getKey().get(), new URLStreamHandler()
                  {
                     @Override
                     protected java.net.URLConnection openConnection(URL u) throws java.io.IOException
                     {
                        return new URLConnection(u)
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.