org.apache.commons.jnet
Class DynamicURLStreamHandlerFactory
java.lang.Object
org.apache.commons.jnet.ParentAwareURLStreamHandlerFactory
org.apache.commons.jnet.DynamicURLStreamHandlerFactory
- All Implemented Interfaces:
- URLStreamHandlerFactory
public class DynamicURLStreamHandlerFactory
- extends ParentAwareURLStreamHandlerFactory
A dynamic url stream handler factory that stores the current delegate factory
in a thread local variable.
This allows to change the url handler factory at runtime dynamically through
the push(URLStreamHandlerFactory)
and pop()
methods.
Field Summary |
protected static ThreadLocal |
FACTORY
The thread local holding the current factory. |
Method Summary |
protected URLStreamHandler |
create(String protocol)
This method can be overwritten by subclasses to instantiate url stream
handlers for the given protocol. |
static void |
pop()
Pop the lastest url stream handler factory from the stack. |
static void |
push(URLStreamHandlerFactory factory)
Push a url stream handler factory on top of the stack. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FACTORY
protected static final ThreadLocal FACTORY
- The thread local holding the current factory.
DynamicURLStreamHandlerFactory
public DynamicURLStreamHandlerFactory()
push
public static void push(URLStreamHandlerFactory factory)
- Push a url stream handler factory on top of the stack.
pop
public static void pop()
- Pop the lastest url stream handler factory from the stack.
create
protected URLStreamHandler create(String protocol)
- Description copied from class:
ParentAwareURLStreamHandlerFactory
- This method can be overwritten by subclasses to instantiate url stream
handlers for the given protocol.
- Specified by:
create
in class ParentAwareURLStreamHandlerFactory
- Parameters:
protocol
- The protocol.
- Returns:
- A url stream handler for the protocol or null.
- See Also:
ParentAwareURLStreamHandlerFactory.create(java.lang.String)
Copyright © 2007-2008 The Apache Software Foundation. All Rights Reserved.