Package java.net

Examples of java.net.URLStreamHandler


        }
    }

    // Test special case of external form with null file part (HARMONY-6254)
    public void test_toExternalForm_Null() throws IOException {
        URLStreamHandler myHandler = new MyHandler2();
        URL url = new URL(null, "foobar://example.com/foobar", myHandler);
        String s = url.toExternalForm();
        assertEquals("Got wrong URL external form", "foobar://example.com", s);
    }
View Full Code Here


        
         public BeansXml getBeansXml()
         {
            try
            {
               Collection<URL> beansXmlPaths = Arrays.asList(new URL(null, "archive://beans.xml", new URLStreamHandler()
               {
                  @Override
                  protected URLConnection openConnection(URL u) throws IOException
                  {
                     return new URLConnection(u)
View Full Code Here

        // (wls i'm looking at you)
        if (isUseSunHttpsHandler()) {
            String sunHandlerClassName = "sun.net.www.protocol.https.Handler";
            Class<URLStreamHandler> clazz = camelContext.getClassResolver().resolveClass(sunHandlerClassName, URLStreamHandler.class);
            if (clazz != null) {
                URLStreamHandler handler = camelContext.getInjector().newInstance(clazz);
                args.setHTTPSHandler(handler);
                LOG.debug("using the URLStreamHandler {} for {}", handler, args);
            } else {
                LOG.warn("could not resolve and use the URLStreamHandler class '{}'", sunHandlerClassName);
            }
View Full Code Here

        try
        {
            String urlLocation = "archive://" + archive.getName() + "/" + beansXmlPath;

            return  new URL(null, urlLocation, new URLStreamHandler()
                        {
                            @Override
                            protected URLConnection openConnection(URL u) throws IOException
                            {
                                return new URLConnection(u)
View Full Code Here

     * @param protocol Protocol
     * @return Custom Xmldb stream handler.
     */
    public URLStreamHandler createURLStreamHandler(String protocol) {
       
        URLStreamHandler handler=null;
       
        if("xmldb".equals(protocol)){
            LOG.debug(protocol);
            handler=new Handler();
        } else {
View Full Code Here

            return new WarURLStreamHandler();
        }

        // Application handlers
        for (URLStreamHandlerFactory factory : userFactories) {
            URLStreamHandler handler =
                factory.createURLStreamHandler(protocol);
            if (handler != null) {
                return handler;
            }
        }
View Full Code Here

                        // it also has the right symbolic name
                        try {
                            new Version(bundleVersion);
                            // Do a file.toURI().toURL() to preserve special path characters
                            // see http://www.javalobby.org/java/forums/t19698.html
                            URL bundleUrl = new URL(null, jarFile.toURI().toURL().toString(), new URLStreamHandler() {
                                @Override
                                protected URLConnection openConnection(final URL u) throws IOException {
                                    return new URLConnection(u) {
                                        @Override
                                        public void connect() throws IOException {
View Full Code Here

            if (protocol == null) {
                throw new IllegalArgumentException("protocol is null");
            }
            protocol = protocol.trim();

            URLStreamHandler handler;

            // first check the registered handlers
            synchronized (this) {
                handler = (URLStreamHandler) handlers.get(protocol);
            }
View Full Code Here

            }
        };

    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

    public URLStreamHandlerTracker(ModuleContext context) {
        tracker = new ServiceTracker<URLStreamHandler, URLStreamHandler>(context, URLStreamHandler.class, null) {

            @Override
            public URLStreamHandler addingService(ServiceReference<URLStreamHandler> sref) {
                URLStreamHandler handler = super.addingService(sref);
                String protocol = getRequiredProtocol(sref);
                URLStreamHandlerProxy proxy = handlers.get(protocol);
                if (proxy == null) {
                    proxy = new URLStreamHandlerProxy(sref, handler);
                    handlers.put(protocol, proxy);
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.