public class URLStreamHandlerFactory
extends java.lang.Object
implements java.net.URLStreamHandlerFactory
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.
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.ThreadLocal |
createURLStreamHandlerProtocol
This thread local is used to prevent recursion in the
createURLStreamHandler method.
|
private static java.util.Map |
handlerMap
A map of protocol names to handlers.
|
private java.lang.String[] |
handlerPkgs
The current packages prefixes determined from the java.protocol.handler.pkgs
property + the org.jboss.net.protocol default package.
|
private java.lang.String |
lastHandlerPkgs
The last java.protocol.handler.pkgs value.
|
private static org.jboss.logging.Logger |
log
Class logger.
|
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 and Description |
|---|
URLStreamHandlerFactory() |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkHandlerPkgs()
See if the java.protocol.handler.pkgs system property has changed
and if it has, parse it to update the handlerPkgs array.
|
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.
|
private static final org.jboss.logging.Logger log
public static final java.lang.String PACKAGE_PREFIX
private static java.util.Map handlerMap
private static java.lang.ThreadLocal createURLStreamHandlerProtocol
URLStreamHandlerFactory that use the TCL. See bug#669043
createURLStreamHandler():146, URLStreamHandlerFactory.java
getURLStreamHandler():1057, URL.java
():405, URL.java
():329, URL.java
():321, URL.java
():540, URLClassPath.java
run():319, URLClassPath.java
doPrivileged():-1, AccessController.java
getLoader():308, URLClassPath.java
getLoader():285, URLClassPath.java
findResource():136, URLClassPath.java
run():351, URLClassLoader.java
doPrivileged():-1, AccessController.java
findResource():348, URLClassLoader.java
getResource():780, ClassLoader.java
getResourceLocally():250, UnifiedClassLoader.java
getResourceFromClassLoader():333, UnifiedLoaderRepository3.java
getResource():243, UnifiedLoaderRepository3.java
getResource():228, UnifiedClassLoader3.java
So we detect recursion based on the protocol value matches the current
createURLStreamHandlerProtocol setting.private java.lang.String[] handlerPkgs
private java.lang.String lastHandlerPkgs
public static final java.lang.String[] PROTOCOLS
public static void preload()
public static void clear()
public java.net.URLStreamHandler createURLStreamHandler(java.lang.String protocol)
createURLStreamHandler in interface java.net.URLStreamHandlerFactoryprotocol - The protocol to create a stream handler forprivate void checkHandlerPkgs()