Class MuleUrlStreamHandlerFactory

  extended by org.mule.util.MuleUrlStreamHandlerFactory
All Implemented Interfaces:

public class MuleUrlStreamHandlerFactory
extends Object
implements URLStreamHandlerFactory

A factory for loading URL protocol handlers. This factory is necessary to make Mule work in cases where the standard approach using system properties does not work, e.g. in application servers or with maven's surefire tests.

Client classes can register a subclass of URLStreamHandler for a given protocol. This implementation first checks its registered handlers before resorting to the default mechanism.

See Also:
URL.URL(String, String, int, String)

Constructor Summary
Method Summary
 URLStreamHandler createURLStreamHandler(String protocol)
static void installUrlStreamHandlerFactory()
          Install an instance of this class as UrlStreamHandlerFactory.
static void registerHandler(String protocol, URLStreamHandler handler)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MuleUrlStreamHandlerFactory()
Method Detail


public static void installUrlStreamHandlerFactory()
Install an instance of this class as UrlStreamHandlerFactory. This may be done exactly once as URL will throw an Error on subsequent invocations.

This method takes care that multiple invocations are possible, but the UrlStreamHandlerFactory is installed only once.


public static void registerHandler(String protocol,
                                   URLStreamHandler handler)


public URLStreamHandler createURLStreamHandler(String protocol)
Specified by:
createURLStreamHandler in interface URLStreamHandlerFactory

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.