Apache Tomcat 6.0.53

org.apache.naming.resources
Class DirContextURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by 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.

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.util.Map getHeaderFields()
          Returns an unmodifiable Map of the header fields.
protected  java.lang.String getHeaderValueAsString(java.lang.Object headerValue)
           
 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, getConnectTimeout, getContentEncoding, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, 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 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

getHeaderValueAsString

protected java.lang.String getHeaderValueAsString(java.lang.Object headerValue)

getHeaderFields

public java.util.Map getHeaderFields()
Returns an unmodifiable Map of the header fields.

Overrides:
getHeaderFields 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
Throws:
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
Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get input stream.

Overrides:
getInputStream in class java.net.URLConnection
Throws:
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.

Throws:
java.io.IOException

Apache Tomcat 6.0.53

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