org.mule.util
Class MuleUrlStreamHandlerFactory

java.lang.Object
  extended by org.mule.util.MuleUrlStreamHandlerFactory
All Implemented Interfaces:
URLStreamHandlerFactory

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
MuleUrlStreamHandlerFactory()
           
 
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

MuleUrlStreamHandlerFactory

public MuleUrlStreamHandlerFactory()
Method Detail

installUrlStreamHandlerFactory

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.


registerHandler

public static void registerHandler(String protocol,
                                   URLStreamHandler handler)

createURLStreamHandler

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


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