org.jboss.net.protocol
Class URLStreamHandlerFactory

java.lang.Object
  extended byorg.jboss.net.protocol.URLStreamHandlerFactory
All Implemented Interfaces:
java.net.URLStreamHandlerFactory

public class URLStreamHandlerFactory
extends java.lang.Object
implements java.net.URLStreamHandlerFactory

A factory for loading URL protocol handlers. This is based on Sun's URL mechanism, in that Handler classes will be searched for in the packages specified by the java.protocol.handler.pkgs property are searched for classes matching the protocol + ".Handler" classname. The default JBoss package "org.jboss.net.protocol" is searched even if not specified in the java.protocol.handler.pkgs property.

This factory is installed by the default server implementaion to ensure that protocol handlers not in the system classpath are located. The thread context class is used first followed by the Class.forName method.

Use preload to force the URL handler map to load the handlers for each protocol listed in PROTOCOLS.


Field Summary
static java.lang.String PACKAGE_PREFIX
          The package prefix where JBoss protocol handlers live.
static java.lang.String[] PROTOCOLS
          A list of JBoss specific protocols for preloading.
 
Constructor Summary
URLStreamHandlerFactory()
           
 
Method Summary
static void clear()
          Clear the current protocol to handler map.
 java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
          Search the handlerPkgs for URLStreamHandler classes matching the pkg + protocol + ".Handler" naming convention.
static void preload()
          Preload the JBoss specific protocol handlers, so that URL knows about them even if the handler factory is changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PACKAGE_PREFIX

public static final java.lang.String PACKAGE_PREFIX
The package prefix where JBoss protocol handlers live.

See Also:
Constant Field Values (src)

PROTOCOLS

public static final java.lang.String[] PROTOCOLS
A list of JBoss specific protocols for preloading.

Constructor Detail

URLStreamHandlerFactory

public URLStreamHandlerFactory()
Method Detail

preload

public static void preload()
Preload the JBoss specific protocol handlers, so that URL knows about them even if the handler factory is changed.


clear

public static void clear()
Clear the current protocol to handler map. The map will be rebuilt as protocol handlers are requested.


createURLStreamHandler

public java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
Search the handlerPkgs for URLStreamHandler classes matching the pkg + protocol + ".Handler" naming convention.

Specified by:
createURLStreamHandler in interface java.net.URLStreamHandlerFactory
Parameters:
protocol - The protocol to create a stream handler for
Returns:
The protocol handler or null if not found
See Also:
#checkHandlerPkgs()