dsto.dfc.net.streams.object
Class Handler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by dsto.dfc.net.streams.object.Handler

public class Handler
extends URLStreamHandler

Handler for URL's using the "object:" protocol. The object protocol allows Java objects to be referenced by their class name eg "object:java.lang.String". If the class is a singleton (ie implements the Singleton interface), the singleton instance is returned as the result of URL.getContent(), otherwise a new instance created using the default constructor is returned.

Version:
$Revision$
See Also:
ObjectURLConnection

Constructor Summary
Handler()
           
 
Method Summary
static Handler getInstance()
          Get the singleton instance of this class.
 URLConnection openConnection(URL url)
           
static void register()
          Register this class as the handler for the "resource:" URL protocol.
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler()
Method Detail

getInstance

public static Handler getInstance()
Get the singleton instance of this class. Other instances may be safely created as well.


register

public static void register()
                     throws UnsupportedOperationException
Register this class as the handler for the "resource:" URL protocol. May be called more than once.

Throws:
UnsupportedOperationException

openConnection

public URLConnection openConnection(URL url)
                             throws IOException
Specified by:
openConnection in class URLStreamHandler
Throws:
IOException


Copyright © 2008 Commonwealth of Australia