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 DirContext
context
Directory 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 void
bind(ClassLoader cl, DirContext dirContext)
Binds a directory context to a class loader.static void
bind(DirContext dirContext)
Binds a directory context to a class loader.static void
bindThread(DirContext dirContext)
Binds a directory context to a thread.static DirContext
get()
Get the bound context.static DirContext
get(ClassLoader cl)
Get the bound context.static DirContext
get(Thread thread)
Get the bound context.static boolean
isBound()
Returns true if the thread or the context class loader of the current thread is bound.protected URLConnection
openConnection(URL u)
Opens a connection to the object referenced by theURL
argument.static void
setProtocolHandler()
Set the java.protocol.handler.pkgs system property.protected String
toExternalForm(URL u)
Converts aURL
of a specific protocol to aString
.static void
unbind()
Unbinds a directory context to a class loader.static void
unbind(ClassLoader cl)
Unbinds a directory context to a class loader.static void
unbindThread()
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 theURL
argument.- Specified by:
openConnection
in 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 aURL
of 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:
toExternalForm
in classURLStreamHandler
- Parameters:
u
- the URL.- Returns:
- a string representation of the
URL
argument.
-
-