## org.apache.naming.resources
Class DirContextURLConnection

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

public class DirContextURLConnection
extends java.net.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.

Version:
  $Revision: 1.12 $
Author:
  Remy Maucherat

Field Summary
`protected javax.naming.directory.Attributes` `attributes` Attributes.
`protected javax.naming.directory.DirContext` `collection` Associated DirContext.
`protected javax.naming.directory.DirContext` `context` Directory context.
`protected long` `date` Date.
`protected java.lang.Object` `object` Other unknown object.
`protected java.security.Permission` `permission` Permission
`protected Resource` `resource` Associated resource.

Fields inherited from class java.net.URLConnection
`allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches`

Constructor Summary
`DirContextURLConnection(javax.naming.directory.DirContext context, java.net.URL url)`

Method Summary
`void` `connect()` Connect to the DirContext, and retrive the bound object, as well as its attributes.
`java.lang.Object` `getContent()` Get object content.
`java.lang.Object` `getContent(java.lang.Class[] classes)` Get object content.
`int` `getContentLength()` Return the content length value.
`java.lang.String` `getContentType()` Return the content type value.
`long` `getDate()` Return the last modified date.
`java.lang.String` `getHeaderField(java.lang.String name)` Returns the name of the specified header field.
`java.io.InputStream` `getInputStream()` Get input stream.
`long` `getLastModified()` Return the last modified date.
`java.security.Permission` `getPermission()` Get the Permission for this URL
`java.util.Enumeration` `list()` List children of this collection.

Methods inherited from class java.net.URLConnection

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

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

Field Detail

### context

    protected javax.naming.directory.DirContext context

  Directory context.

### resource

    protected Resource resource

  Associated resource.

### collection

    protected javax.naming.directory.DirContext collection

  Associated DirContext.

### object

    protected java.lang.Object object

  Other unknown object.

### attributes

    protected javax.naming.directory.Attributes attributes

  Attributes.

### date

    protected long date

  Date.

### permission

    protected java.security.Permission permission

  Permission

Constructor Detail

### DirContextURLConnection

    public DirContextURLConnection(javax.naming.directory.DirContext context,
                                   java.net.URL url)

Method Detail

### connect

    public void connect()
                 throws java.io.IOException

  Connect to the DirContext, and retrive 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 `java.net.URLConnection`
  Throws:
    `java.io.IOException` - Object not found

### getContentLength

    public int getContentLength()

  Return the content length value.

  Overrides:
    `getContentLength` in class `java.net.URLConnection`

### getContentType

    public java.lang.String getContentType()

  Return the content type value.

  Overrides:
    `getContentType` in class `java.net.URLConnection`

### getDate

    public long getDate()

  Return the last modified date.

  Overrides:
    `getDate` in class `java.net.URLConnection`

### getLastModified

    public long getLastModified()

  Return the last modified date.

  Overrides:
    `getLastModified` in class `java.net.URLConnection`

### getHeaderField

    public java.lang.String getHeaderField(java.lang.String name)

  Returns the name of the specified header field.

  Overrides:
    `getHeaderField` in class `java.net.URLConnection`

### getContent

    public java.lang.Object getContent()
                                throws java.io.IOException

  Get object content.

  Overrides:
    `getContent` in class `java.net.URLConnection`
    `java.io.IOException`

### getContent

    public java.lang.Object getContent(java.lang.Class[] classes)
                                throws java.io.IOException

  Get object content.

  Overrides:
    `getContent` in class `java.net.URLConnection`
    `java.io.IOException`

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.io.IOException

  Get input stream.

  Overrides:
    `getInputStream` in class `java.net.URLConnection`
    `java.io.IOException`

### getPermission

    public java.security.Permission getPermission()

  Get the Permission for this URL

  Overrides:
    `getPermission` in class `java.net.URLConnection`

### list

    public java.util.Enumeration list()
                               throws java.io.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.

    `java.io.IOException`

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