## 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 java.net.URLStreamHandler

Stream handler to a JNDI directory context.

Version:
  $Revision: 467222 $
Author:
  Remy Maucherat

Field Summary
`protected javax.naming.directory.DirContext` `context` Directory context.

Constructor Summary
`DirContextURLStreamHandler()`
`DirContextURLStreamHandler(javax.naming.directory.DirContext context)`

Method Summary
`static void` `bind(java.lang.ClassLoader cl, javax.naming.directory.DirContext dirContext)` Binds a directory context to a class loader.
`static void` `bind(javax.naming.directory.DirContext dirContext)` Binds a directory context to a class loader.
`static void` `bindThread(javax.naming.directory.DirContext dirContext)` Binds a directory context to a thread.
`static javax.naming.directory.DirContext` `get()` Get the bound context.
`static javax.naming.directory.DirContext` `get(java.lang.ClassLoader cl)` Get the bound context.
`static javax.naming.directory.DirContext` `get(java.lang.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 java.net.URLConnection` `openConnection(java.net.URL u)` Opens a connection to the object referenced by the `URL` argument.
`static void` `setProtocolHandler()` Set the java.protocol.handler.pkgs system property.
`protected java.lang.String` `toExternalForm(java.net.URL u)` Override as part of the fix for 36534, to ensure toString is correct.
`static void` `unbind()` Unbinds a directory context to a class loader.
`static void` `unbind(java.lang.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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### context

    protected javax.naming.directory.DirContext context

  Directory context.

Constructor Detail

### DirContextURLStreamHandler

    public DirContextURLStreamHandler()

### DirContextURLStreamHandler

    public DirContextURLStreamHandler(javax.naming.directory.DirContext context)

Method Detail

### openConnection

    protected java.net.URLConnection openConnection(java.net.URL u)
                                             throws java.io.IOException

  Opens a connection to the object referenced by the `URL` argument.

  Specified by:
    `openConnection` in class `java.net.URLStreamHandler`
  Throws:
    `java.io.IOException`

### toExternalForm

    protected java.lang.String toExternalForm(java.net.URL u)

  Override as part of the fix for 36534, to ensure toString is correct.

  Overrides:
    `toExternalForm` in class `java.net.URLStreamHandler`

### 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(javax.naming.directory.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(javax.naming.directory.DirContext dirContext)

  Binds a directory context to a thread.

### unbindThread

    public static void unbindThread()

  Unbinds a directory context to a thread.

### get

    public static javax.naming.directory.DirContext get()

  Get the bound context.

### bind

    public static void bind(java.lang.ClassLoader cl,
                            javax.naming.directory.DirContext dirContext)

  Binds a directory context to a class loader.

### unbind

    public static void unbind(java.lang.ClassLoader cl)

  Unbinds a directory context to a class loader.

### get

    public static javax.naming.directory.DirContext get(java.lang.ClassLoader cl)

  Get the bound context.

### get

    public static javax.naming.directory.DirContext get(java.lang.Thread thread)

  Get the bound context.

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.