DirContextURLStreamHandler (Apache Tomcat 7.0.104 API Documentation)

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.
  Author:
    Remy Maucherat

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DirContext` | `context` Directory context.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirContextURLStreamHandler()`
    `DirContextURLStreamHandler(DirContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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 the `URL` argument.
    `static void` | `setProtocolHandler()` Set the java.protocol.handler.pkgs system property.
    `protected String` | `toExternalForm(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(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 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 the `URL` argument.
      Specified by:
        `openConnection` in class `URLStreamHandler`
      Throws:
        `IOException`

    - #### toExternalForm

          protected String toExternalForm(URL u)

      Override as part of the fix for 36534, to ensure toString is correct.
      Overrides:
        `toExternalForm` in class `URLStreamHandler`

    - #### setProtocolHandler

          public static void setProtocolHandler()

      Set the java.protocol.handler.pkgs system property. For use when embedding Tomcat and the embedding application has already set its own `URLStreamHandlerFactory`.

    - #### 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.

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