org.apache.commons.jnet
Class DynamicURLStreamHandlerFactory

java.lang.Object
  extended by org.apache.commons.jnet.ParentAwareURLStreamHandlerFactory
      extended by 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.
 
Fields inherited from class org.apache.commons.jnet.ParentAwareURLStreamHandlerFactory
parentFactory
 
Constructor Summary
DynamicURLStreamHandlerFactory()
           
 
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 org.apache.commons.jnet.ParentAwareURLStreamHandlerFactory
createURLStreamHandler, getParent, setParentFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY

protected static final ThreadLocal FACTORY
The thread local holding the current factory.

Constructor Detail

DynamicURLStreamHandlerFactory

public DynamicURLStreamHandlerFactory()
Method Detail

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.