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 AttributesattributesAttributes.protected DirContextcollectionAssociated DirContext.protected DirContextcontextDirectory context.protected longdateDate.static booleanIS_SECURITY_ENABLEDIs the Java SecurityManager enabled?protected ObjectobjectOther unknown object.protected PermissionpermissionPermissionprotected ResourceresourceAssociated 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 voidconnect()Connect to the DirContext, and retrive the bound object, as well as its attributes.ObjectgetContent()Get object content.ObjectgetContent(Class[] classes)Get object content.intgetContentLength()Return the content length value.StringgetContentType()Return the content type value.longgetDate()Return the last modified date.StringgetHeaderField(String name)Returns the name of the specified header field.Map<String,List<String>>getHeaderFields()Returns an unmodifiable Map of the header fields.InputStreamgetInputStream()Get input stream.longgetLastModified()Return the last modified date.PermissiongetPermission()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 IOExceptionConnect 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:
connectin classURLConnection- Throws:
IOException- Object not found
-
getContentLength
public int getContentLength()
Return the content length value.- Overrides:
getContentLengthin classURLConnection
-
getContentType
public String getContentType()
Return the content type value.- Overrides:
getContentTypein classURLConnection
-
getDate
public long getDate()
Return the last modified date.- Overrides:
getDatein classURLConnection
-
getLastModified
public long getLastModified()
Return the last modified date.- Overrides:
getLastModifiedin classURLConnection
-
getHeaderFields
public Map<String,List<String>> getHeaderFields()
Returns an unmodifiable Map of the header fields.- Overrides:
getHeaderFieldsin classURLConnection
-
getHeaderField
public String getHeaderField(String name)
Returns the name of the specified header field.- Overrides:
getHeaderFieldin classURLConnection
-
getContent
public Object getContent() throws IOException
Get object content.- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getContent
public Object getContent(Class[] classes) throws IOException
Get object content.- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws IOException
Get input stream.- Overrides:
getInputStreamin classURLConnection- Throws:
IOException
-
getPermission
public Permission getPermission()
Get the Permission for this URL- Overrides:
getPermissionin 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
-
-