Package org.apache.naming.resources
Class DirContextURLStreamHandler
- java.lang.Object
-
- java.net.URLStreamHandler
-
- org.apache.naming.resources.DirContextURLStreamHandler
-
- Direct Known Subclasses:
Handler
public class DirContextURLStreamHandler extends URLStreamHandler
Stream handler to a JNDI directory context.- Version:
- $Revision: 1.3 $
- Author:
- Remy Maucherat
-
-
Field Summary
Fields Modifier and Type Field Description protected DirContextcontextDirectory context.
-
Constructor Summary
Constructors Constructor Description DirContextURLStreamHandler()DirContextURLStreamHandler(DirContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidbind(ClassLoader cl, DirContext dirContext)Binds a directory context to a class loader.static voidbind(DirContext dirContext)Binds a directory context to a class loader.static voidbindThread(DirContext dirContext)Binds a directory context to a thread.static DirContextget()Get the bound context.static DirContextget(ClassLoader cl)Get the bound context.static DirContextget(Thread thread)Get the bound context.static booleanisBound()Returns true if the thread or the context class loader of the current thread is bound.protected URLConnectionopenConnection(URL u)Opens a connection to the object referenced by theURLargument.static voidsetProtocolHandler()Set the java.protocol.handler.pkgs system property.protected StringtoExternalForm(URL u)Converts aURLof a specific protocol to aString.static voidunbind()Unbinds a directory context to a class loader.static voidunbind(ClassLoader cl)Unbinds a directory context to a class loader.static voidunbindThread()Unbinds a directory context to a thread.-
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL
-
-
-
-
Field Detail
-
context
protected DirContext context
Directory context.
-
-
Constructor Detail
-
DirContextURLStreamHandler
public DirContextURLStreamHandler()
-
DirContextURLStreamHandler
public DirContextURLStreamHandler(DirContext context)
-
-
Method Detail
-
openConnection
protected URLConnection openConnection(URL u) throws IOException
Opens a connection to the object referenced by theURLargument.- Specified by:
openConnectionin classURLStreamHandler- Throws:
IOException
-
setProtocolHandler
public static void setProtocolHandler()
Set the java.protocol.handler.pkgs system property.
-
isBound
public static boolean isBound()
Returns true if the thread or the context class loader of the current thread is bound.
-
bind
public static void bind(DirContext dirContext)
Binds a directory context to a class loader.
-
unbind
public static void unbind()
Unbinds a directory context to a class loader.
-
bindThread
public static void bindThread(DirContext dirContext)
Binds a directory context to a thread.
-
unbindThread
public static void unbindThread()
Unbinds a directory context to a thread.
-
get
public static DirContext get()
Get the bound context.
-
bind
public static void bind(ClassLoader cl, DirContext dirContext)
Binds a directory context to a class loader.
-
unbind
public static void unbind(ClassLoader cl)
Unbinds a directory context to a class loader.
-
get
public static DirContext get(ClassLoader cl)
Get the bound context.
-
get
public static DirContext get(Thread thread)
Get the bound context.
-
toExternalForm
protected String toExternalForm(URL u)
Converts aURLof a specific protocol to aString. The impl of this method is almost identical to that of the java.net.URLStreamHandler superclass, except that it omits the URL's authority field from the URL's String representation.- Overrides:
toExternalFormin classURLStreamHandler- Parameters:
u- the URL.- Returns:
- a string representation of the
URLargument.
-
-