Package 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.- Version:
- $Revision: 1.3 $
- Author:
- Remy Maucherat
-
-
Field Summary
Fields Modifier and Type Field Description protected Attributes
attributes
Attributes.protected DirContext
collection
Associated DirContext.protected DirContext
context
Directory context.protected long
date
Date.static boolean
IS_SECURITY_ENABLED
Is the Java SecurityManager enabled?protected Object
object
Other unknown object.protected Permission
permission
Permissionprotected Resource
resource
Associated resource.-
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
-
Constructor Summary
Constructors Constructor Description DirContextURLConnection(DirContext context, URL url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
Connect to the DirContext, and retrive 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.InputStream
getInputStream()
Get input stream.long
getLastModified()
Return the last modified date.Permission
getPermission()
Get the Permission for this URLEnumeration<String>
list()
List children of this collection.-
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContentEncoding, getContentLengthLong, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, 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, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
-
-
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
-
IS_SECURITY_ENABLED
public static final boolean IS_SECURITY_ENABLED
Is the Java SecurityManager enabled?
-
-
Constructor Detail
-
DirContextURLConnection
public DirContextURLConnection(DirContext context, URL url)
-
-
Method Detail
-
connect
public void connect() throws 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 classURLConnection
- Throws:
IOException
- Object not found
-
getContentLength
public int getContentLength()
Return the content length value.- Overrides:
getContentLength
in classURLConnection
-
getContentType
public String getContentType()
Return the content type value.- Overrides:
getContentType
in classURLConnection
-
getDate
public long getDate()
Return the last modified date.- Overrides:
getDate
in classURLConnection
-
getLastModified
public long getLastModified()
Return the last modified date.- Overrides:
getLastModified
in classURLConnection
-
getHeaderFields
public Map<String,List<String>> getHeaderFields()
Returns an unmodifiable Map of the header fields.- Overrides:
getHeaderFields
in classURLConnection
-
getHeaderField
public String getHeaderField(String name)
Returns the name of the specified header field.- Overrides:
getHeaderField
in classURLConnection
-
getContent
public Object getContent() throws IOException
Get object content.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getContent
public Object getContent(Class[] classes) throws IOException
Get object content.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
Get input stream.- Overrides:
getInputStream
in classURLConnection
- Throws:
IOException
-
getPermission
public Permission getPermission()
Get the Permission for this URL- Overrides:
getPermission
in classURLConnection
-
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
-
-