org.apache.naming.resources

## Class DirContextURLConnection

- java.lang.Object
- - java.net.URLConnection
  - - org.apache.naming.resources.DirContextURLConnection

-     public class DirContextURLConnection
      extends URLConnection

  Connection to a JNDI directory context.

  Note: All the object attribute names are the WebDAV names, not the HTTP names, so this class overrides some methods from URLConnection to do the queries using the right names. Content handler is also not used; the content is directly returned.
  Author:
    Remy Maucherat

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Attributes` | `attributes` Attributes.
    `protected DirContext` | `collection` Associated DirContext.
    `protected DirContext` | `context` Directory context.
    `protected long` | `date` Date.
    `protected Object` | `object` Other unknown object.
    `protected Permission` | `permission` Permission
    `protected Resource` | `resource` Associated resource.

    - ### Fields inherited from class java.net.URLConnection

      `allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirContextURLConnection(DirContext context, URL url)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect()` Connect to the DirContext, and retrieve the bound object, as well as its attributes.
    `Object` | `getContent()` Get object content.
    `Object` | `getContent(Class[] classes)` Get object content.
    `int` | `getContentLength()` Return the content length value.
    `String` | `getContentType()` Return the content type value.
    `long` | `getDate()` Return the last modified date.
    `String` | `getHeaderField(String name)` Returns the name of the specified header field.
    `Map<String,List<String>>` | `getHeaderFields()` Returns an unmodifiable Map of the header fields.
    `protected String` | `getHeaderValueAsString(Object headerValue)`
    `InputStream` | `getInputStream()` Get input stream.
    `long` | `getLastModified()` Return the last modified date.
    `Permission` | `getPermission()` Get the Permission for this URL
    `Enumeration<String>` | `list()` List children of this collection.

    - ### Methods inherited from class java.net.URLConnection

      `addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContentEncoding, getContentLengthLong, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getIfModifiedSince, getOutputStream, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### context

          protected DirContext context

      Directory context.

    - #### resource

          protected Resource resource

      Associated resource.

    - #### collection

          protected DirContext collection

      Associated DirContext.

    - #### object

          protected Object object

      Other unknown object.

    - #### attributes

          protected Attributes attributes

      Attributes.

    - #### date

          protected long date

      Date.

    - #### permission

          protected Permission permission

      Permission

  - ### Constructor Detail

    - #### DirContextURLConnection

          public DirContextURLConnection(DirContext context,
                                 URL url)

  - ### Method Detail

    - #### connect

          public void connect()
                       throws IOException

      Connect to the DirContext, and retrieve the bound object, as well as its attributes. If no object is bound with the name specified in the URL, then an IOException is thrown.
      Specified by:
        `connect` in class `URLConnection`
      Throws:
        `IOException` - Object not found

    - #### getContentLength

          public int getContentLength()

      Return the content length value.
      Overrides:
        `getContentLength` in class `URLConnection`

    - #### getContentType

          public String getContentType()

      Return the content type value.
      Overrides:
        `getContentType` in class `URLConnection`

    - #### getDate

          public long getDate()

      Return the last modified date.
      Overrides:
        `getDate` in class `URLConnection`

    - #### getLastModified

          public long getLastModified()

      Return the last modified date.
      Overrides:
        `getLastModified` in class `URLConnection`

    - #### getHeaderValueAsString

          protected String getHeaderValueAsString(Object headerValue)

    - #### getHeaderFields

          public Map<String,List<String>> getHeaderFields()

      Returns an unmodifiable Map of the header fields.
      Overrides:
        `getHeaderFields` in class `URLConnection`

    - #### getHeaderField

          public String getHeaderField(String name)

      Returns the name of the specified header field.
      Overrides:
        `getHeaderField` in class `URLConnection`

    - #### getContent

          public Object getContent()
                            throws IOException

      Get object content.
      Overrides:
        `getContent` in class `URLConnection`
      Throws:
        `IOException`

    - #### getContent

          public Object getContent(Class[] classes)
                            throws IOException

      Get object content.
      Overrides:
        `getContent` in class `URLConnection`
      Throws:
        `IOException`

    - #### getInputStream

          public InputStream getInputStream()
                                     throws IOException

      Get input stream.
      Overrides:
        `getInputStream` in class `URLConnection`
      Throws:
        `IOException`

    - #### getPermission

          public Permission getPermission()

      Get the Permission for this URL
      Overrides:
        `getPermission` in class `URLConnection`

    - #### list

          public Enumeration<String> list()
                                   throws IOException

      List children of this collection. The names given are relative to this URI's path. The full uri of the children is then : path + "/" + name.
      Throws:
        `IOException`

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