Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.common.utils
Class URLStreamHandlerFactoryInstaller

java.lang.Object
  extended by org.nuxeo.common.utils.URLStreamHandlerFactoryInstaller

public class URLStreamHandlerFactoryInstaller
extends Object

Used to force installation of URLStreamHandlerFactory as the default mechanism in Java is failing to set a new factory if one was already set.

This class provides the capability to stack any number of factories - each factory having precedence over the last one.

Thus, when querying for a URL protocol handler all factories will be asked in turn (from the newest one to the older one) until a stream handler is obtained.

Contains some code from Eclipse Framework class.

Author:
Bogdan Stefanescu

Nested Class Summary
static class URLStreamHandlerFactoryInstaller.FactoryStack
           
 
Method Summary
static URLStreamHandlerFactoryInstaller.FactoryStack getStack()
          Get the underlying stack.
static void installURLStreamHandlerFactory(URLStreamHandlerFactory shf)
           
static void resetURLStreamHandlers()
           
static void uninstallURLStreamHandlerFactory()
           
static void uninstallURLStreamHandlerFactory(URLStreamHandlerFactory shf)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

installURLStreamHandlerFactory

public static void installURLStreamHandlerFactory(URLStreamHandlerFactory shf)
                                           throws Exception
Throws:
Exception

uninstallURLStreamHandlerFactory

public static void uninstallURLStreamHandlerFactory()

uninstallURLStreamHandlerFactory

public static void uninstallURLStreamHandlerFactory(URLStreamHandlerFactory shf)

resetURLStreamHandlers

public static void resetURLStreamHandlers()

getStack

public static URLStreamHandlerFactoryInstaller.FactoryStack getStack()
Get the underlying stack.

This should not be used to register/unregister factories (since it is not synchronized). To install / uninstall factories use the static method of that class.


Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.