Package org.apache.naming.resources
Class ResourceAttributes
- java.lang.Object
-
- org.apache.naming.resources.ResourceAttributes
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Attributes
- Direct Known Subclasses:
FileDirContext.FileResourceAttributes
,WebDirContext.JarResourceAttributes
public class ResourceAttributes extends Object implements Attributes
Attributes implementation.- Version:
- $Revision: 1.1.2.1 $
- Author:
- Remy Maucherat
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALTERNATE_CONTENT_LENGTH
Content length.static String
ALTERNATE_CREATION_DATE
Creation date.static String
ALTERNATE_ETAG
ETag.static String
ALTERNATE_LAST_MODIFIED
Last modification date.static String
ALTERNATE_TYPE
Type.protected Attributes
attributes
External attributes.protected boolean
collection
Collection flag.static String
COLLECTION_TYPE
Collection type.static String
CONTENT_LANGUAGE
Content language.static String
CONTENT_LENGTH
Content length.static String
CONTENT_TYPE
MIME type of the content.protected long
contentLength
Content length.protected long
creation
Creation time.static String
CREATION_DATE
Creation date.protected Date
creationDate
Creation date.static String
ETAG
ETag.protected static ThreadLocal<SimpleDateFormat>
FORMAT
HTTP date format.protected static ThreadLocal
FORMATS
Date formats using for Date parsing.protected static TimeZone
gmtZone
static String
LAST_MODIFIED
Last modification date.protected long
lastModified
Last modified time.protected Date
lastModifiedDate
Last modified date.protected String
lastModifiedHttp
Last modified date in HTTP format.protected String
mimeType
MIME type.protected String
name
Name.static String
NAME
Name.static String
SOURCE
Source.protected String
strongETag
Strong ETag.static String
TYPE
Type.protected String
weakETag
Weak ETag.
-
Constructor Summary
Constructors Constructor Description ResourceAttributes()
Default constructor.ResourceAttributes(Attributes attributes)
Merges with another attribute set.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Object
clone()
Clone the attributes objectAttribute
get(String attrID)
Get attribute.NamingEnumeration<? extends Attribute>
getAll()
Get all attributes.String
getCanonicalPath()
Return the canonical path of the resource, to possibly be used for direct file serving.long
getContentLength()
Get content length.long
getCreation()
Get creation time.Date
getCreationDate()
Get creation date.Date
getCreationOrLastModifiedDate()
String
getETag()
Get ETag.String
getETag(boolean strong)
Deprecated.NamingEnumeration<String>
getIDs()
Get all attribute IDs.long
getLastModified()
Get last modified time.Date
getLastModifiedDate()
Get lastModified date.String
getLastModifiedHttp()
String
getMimeType()
String
getName()
Get name.String
getResourceType()
Get resource type.boolean
isCaseIgnored()
Case sensitivity.boolean
isCollection()
Is collection.boolean
isMimeTypeInitialized()
Attribute
put(String attrID, Object val)
Put attribute.Attribute
put(Attribute attribute)
Put attribute.Attribute
remove(String attrID)
Remove attribute.void
setCollection(boolean collection)
Set collection flag.void
setContentLength(long contentLength)
Set content length.void
setCreation(long creation)
Set creation.void
setCreationDate(Date creationDate)
Creation date mutator.void
setETag(String eTag)
Set strong ETag.void
setLastModified(long lastModified)
Set last modified.void
setLastModified(Date lastModified)
Deprecated.void
setLastModifiedDate(Date lastModifiedDate)
Last modified date mutator.void
setLastModifiedHttp(String lastModifiedHttp)
void
setMimeType(String mimeType)
void
setName(String name)
Set name.void
setResourceType(String resourceType)
Type mutator.int
size()
Retrieves the number of attributes in the attribute set.
-
-
-
Field Detail
-
CREATION_DATE
public static final String CREATION_DATE
Creation date.- See Also:
- Constant Field Values
-
ALTERNATE_CREATION_DATE
public static final String ALTERNATE_CREATION_DATE
Creation date.- See Also:
- Constant Field Values
-
LAST_MODIFIED
public static final String LAST_MODIFIED
Last modification date.- See Also:
- Constant Field Values
-
ALTERNATE_LAST_MODIFIED
public static final String ALTERNATE_LAST_MODIFIED
Last modification date.- See Also:
- Constant Field Values
-
NAME
public static final String NAME
Name.- See Also:
- Constant Field Values
-
TYPE
public static final String TYPE
Type.- See Also:
- Constant Field Values
-
ALTERNATE_TYPE
public static final String ALTERNATE_TYPE
Type.- See Also:
- Constant Field Values
-
SOURCE
public static final String SOURCE
Source.- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
MIME type of the content.- See Also:
- Constant Field Values
-
CONTENT_LANGUAGE
public static final String CONTENT_LANGUAGE
Content language.- See Also:
- Constant Field Values
-
CONTENT_LENGTH
public static final String CONTENT_LENGTH
Content length.- See Also:
- Constant Field Values
-
ALTERNATE_CONTENT_LENGTH
public static final String ALTERNATE_CONTENT_LENGTH
Content length.- See Also:
- Constant Field Values
-
ETAG
public static final String ETAG
ETag.- See Also:
- Constant Field Values
-
ALTERNATE_ETAG
public static final String ALTERNATE_ETAG
ETag.- See Also:
- Constant Field Values
-
COLLECTION_TYPE
public static final String COLLECTION_TYPE
Collection type.- See Also:
- Constant Field Values
-
gmtZone
protected static final TimeZone gmtZone
-
FORMAT
protected static final ThreadLocal<SimpleDateFormat> FORMAT
HTTP date format.
-
FORMATS
protected static final ThreadLocal FORMATS
Date formats using for Date parsing.
-
collection
protected boolean collection
Collection flag.
-
contentLength
protected long contentLength
Content length.
-
creation
protected long creation
Creation time.
-
creationDate
protected Date creationDate
Creation date.
-
lastModified
protected long lastModified
Last modified time.
-
lastModifiedDate
protected Date lastModifiedDate
Last modified date.
-
lastModifiedHttp
protected String lastModifiedHttp
Last modified date in HTTP format.
-
mimeType
protected String mimeType
MIME type.
-
name
protected String name
Name.
-
weakETag
protected String weakETag
Weak ETag.
-
strongETag
protected String strongETag
Strong ETag.
-
attributes
protected Attributes attributes
External attributes.
-
-
Constructor Detail
-
ResourceAttributes
public ResourceAttributes()
Default constructor.
-
ResourceAttributes
public ResourceAttributes(Attributes attributes)
Merges with another attribute set.
-
-
Method Detail
-
isCollection
public boolean isCollection()
Is collection.
-
setCollection
public void setCollection(boolean collection)
Set collection flag.
-
getContentLength
public long getContentLength()
Get content length.- Returns:
- content length value
-
setContentLength
public void setContentLength(long contentLength)
Set content length.- Parameters:
contentLength
- New content length value
-
getCreation
public long getCreation()
Get creation time.- Returns:
- creation time value
-
setCreation
public void setCreation(long creation)
Set creation.- Parameters:
creation
- New creation value
-
getCreationDate
public Date getCreationDate()
Get creation date.- Returns:
- Creation date value
-
setCreationDate
public void setCreationDate(Date creationDate)
Creation date mutator.- Parameters:
creationDate
- New creation date
-
getLastModified
public long getLastModified()
Get last modified time.- Returns:
- lastModified time value
-
setLastModified
public void setLastModified(long lastModified)
Set last modified.- Parameters:
lastModified
- New last modified value
-
setLastModified
public void setLastModified(Date lastModified)
Deprecated.Set last modified date.- Parameters:
lastModified
- New last modified date value
-
getLastModifiedDate
public Date getLastModifiedDate()
Get lastModified date.- Returns:
- LastModified date value
-
setLastModifiedDate
public void setLastModifiedDate(Date lastModifiedDate)
Last modified date mutator.- Parameters:
lastModifiedDate
- New last modified date
-
getLastModifiedHttp
public String getLastModifiedHttp()
- Returns:
- Returns the lastModifiedHttp.
-
getCreationOrLastModifiedDate
public Date getCreationOrLastModifiedDate()
- Returns:
- the creation or lastModified date
-
setLastModifiedHttp
public void setLastModifiedHttp(String lastModifiedHttp)
- Parameters:
lastModifiedHttp
- The lastModifiedHttp to set.
-
getMimeType
public String getMimeType()
- Returns:
- Returns the mimeType.
-
setMimeType
public void setMimeType(String mimeType)
- Parameters:
mimeType
- The mimeType to set.
-
isMimeTypeInitialized
public boolean isMimeTypeInitialized()
-
getName
public String getName()
Get name.- Returns:
- Name value
-
setName
public void setName(String name)
Set name.- Parameters:
name
- New name value
-
getResourceType
public String getResourceType()
Get resource type.- Returns:
- String resource type
-
setResourceType
public void setResourceType(String resourceType)
Type mutator.- Parameters:
resourceType
- New resource type
-
getETag
public String getETag()
Get ETag.- Returns:
- strong ETag if available, else weak ETag
-
getETag
public String getETag(boolean strong)
Deprecated.Get ETag.- Parameters:
strong
- Ignored- Returns:
- strong ETag if available, else weak ETag.
-
setETag
public void setETag(String eTag)
Set strong ETag.
-
getCanonicalPath
public String getCanonicalPath()
Return the canonical path of the resource, to possibly be used for direct file serving. Implementations which support this should override it to return the file path.- Returns:
- The canonical path of the resource
-
get
public Attribute get(String attrID)
Get attribute.- Specified by:
get
in interfaceAttributes
-
put
public Attribute put(Attribute attribute)
Put attribute.- Specified by:
put
in interfaceAttributes
-
put
public Attribute put(String attrID, Object val)
Put attribute.- Specified by:
put
in interfaceAttributes
-
remove
public Attribute remove(String attrID)
Remove attribute.- Specified by:
remove
in interfaceAttributes
-
getAll
public NamingEnumeration<? extends Attribute> getAll()
Get all attributes.- Specified by:
getAll
in interfaceAttributes
-
getIDs
public NamingEnumeration<String> getIDs()
Get all attribute IDs.- Specified by:
getIDs
in interfaceAttributes
-
size
public int size()
Retrieves the number of attributes in the attribute set.- Specified by:
size
in interfaceAttributes
-
clone
public Object clone()
Clone the attributes object- Specified by:
clone
in interfaceAttributes
- Overrides:
clone
in classObject
-
isCaseIgnored
public boolean isCaseIgnored()
Case sensitivity.- Specified by:
isCaseIgnored
in interfaceAttributes
-
-