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 StringALTERNATE_CONTENT_LENGTHContent length.static StringALTERNATE_CREATION_DATECreation date.static StringALTERNATE_ETAGETag.static StringALTERNATE_LAST_MODIFIEDLast modification date.static StringALTERNATE_TYPEType.protected AttributesattributesExternal attributes.protected booleancollectionCollection flag.static StringCOLLECTION_TYPECollection type.static StringCONTENT_LANGUAGEContent language.static StringCONTENT_LENGTHContent length.static StringCONTENT_TYPEMIME type of the content.protected longcontentLengthContent length.protected longcreationCreation time.static StringCREATION_DATECreation date.protected DatecreationDateCreation date.static StringETAGETag.protected static ThreadLocal<SimpleDateFormat>FORMATHTTP date format.protected static ThreadLocalFORMATSDate formats using for Date parsing.protected static TimeZonegmtZonestatic StringLAST_MODIFIEDLast modification date.protected longlastModifiedLast modified time.protected DatelastModifiedDateLast modified date.protected StringlastModifiedHttpLast modified date in HTTP format.protected StringmimeTypeMIME type.protected StringnameName.static StringNAMEName.static StringSOURCESource.protected StringstrongETagStrong ETag.static StringTYPEType.protected StringweakETagWeak 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 Objectclone()Clone the attributes objectAttributeget(String attrID)Get attribute.NamingEnumeration<? extends Attribute>getAll()Get all attributes.StringgetCanonicalPath()Return the canonical path of the resource, to possibly be used for direct file serving.longgetContentLength()Get content length.longgetCreation()Get creation time.DategetCreationDate()Get creation date.DategetCreationOrLastModifiedDate()StringgetETag()Get ETag.StringgetETag(boolean strong)Deprecated.NamingEnumeration<String>getIDs()Get all attribute IDs.longgetLastModified()Get last modified time.DategetLastModifiedDate()Get lastModified date.StringgetLastModifiedHttp()StringgetMimeType()StringgetName()Get name.StringgetResourceType()Get resource type.booleanisCaseIgnored()Case sensitivity.booleanisCollection()Is collection.booleanisMimeTypeInitialized()Attributeput(String attrID, Object val)Put attribute.Attributeput(Attribute attribute)Put attribute.Attributeremove(String attrID)Remove attribute.voidsetCollection(boolean collection)Set collection flag.voidsetContentLength(long contentLength)Set content length.voidsetCreation(long creation)Set creation.voidsetCreationDate(Date creationDate)Creation date mutator.voidsetETag(String eTag)Set strong ETag.voidsetLastModified(long lastModified)Set last modified.voidsetLastModified(Date lastModified)Deprecated.voidsetLastModifiedDate(Date lastModifiedDate)Last modified date mutator.voidsetLastModifiedHttp(String lastModifiedHttp)voidsetMimeType(String mimeType)voidsetName(String name)Set name.voidsetResourceType(String resourceType)Type mutator.intsize()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:
getin interfaceAttributes
-
put
public Attribute put(Attribute attribute)
Put attribute.- Specified by:
putin interfaceAttributes
-
put
public Attribute put(String attrID, Object val)
Put attribute.- Specified by:
putin interfaceAttributes
-
remove
public Attribute remove(String attrID)
Remove attribute.- Specified by:
removein interfaceAttributes
-
getAll
public NamingEnumeration<? extends Attribute> getAll()
Get all attributes.- Specified by:
getAllin interfaceAttributes
-
getIDs
public NamingEnumeration<String> getIDs()
Get all attribute IDs.- Specified by:
getIDsin interfaceAttributes
-
size
public int size()
Retrieves the number of attributes in the attribute set.- Specified by:
sizein interfaceAttributes
-
clone
public Object clone()
Clone the attributes object- Specified by:
clonein interfaceAttributes- Overrides:
clonein classObject
-
isCaseIgnored
public boolean isCaseIgnored()
Case sensitivity.- Specified by:
isCaseIgnoredin interfaceAttributes
-
-