public class ResourceMetadata extends HashMap<String,Object>
ResourceMetadata
interface defines the API for the
metadata of a Sling Resource
. Essentially the resource's metadata is
just a map of objects indexed by string keys.
The actual contents of the meta data map is implementation specific with the
exception of the sling.resolutionPath
property which
must be provided by all implementations and contain the part of the request
URI used to resolve the resource. The type of this property value is defined
to be String
.
Note, that the prefix sling. to key names is reserved for the
Sling implementation.
Once a resource is returned by the ResourceResolver
, the resource
metadata is made read-only and therefore can't be changed by client code!
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
static String |
CHARACTER_ENCODING
The name of the optional property providing the character encoding of the
resource if the resource is streamable and contains character data (value
is "sling.characterEncoding").
|
static String |
CONTENT_LENGTH
The name of the optional property providing the content length of the
resource if the resource is streamable (value is "sling.contentLength").
|
static String |
CONTENT_TYPE
The name of the optional property providing the content type of the
resource if the resource is streamable (value is "sling.contentType").
|
static String |
CREATION_TIME
Returns the creation time of this resource in the repository in
milliseconds (value is "sling.creationTime").
|
static String |
INTERNAL_CONTINUE_RESOLVING
Returns whether the resource resolver should continue to search for a
resource.
|
static String |
MODIFICATION_TIME
Returns the last modification time of this resource in the repository in
milliseconds (value is "sling.modificationTime").
|
static String |
PARAMETER_MAP
Returns a map containing parameters added to path after semicolon.
|
static String |
RESOLUTION_PATH
The name of the required property providing the part of the request URI
which was used to the resolve the resource to which the meta data
instance belongs (value is "sling.resolutionPath").
|
static String |
RESOLUTION_PATH_INFO
The name of the required property providing the part of the request URI
which was not used to the resolve the resource to which the meta data
instance belongs (value is "sling.resolutionPathInfo").
|
Constructor and Description |
---|
ResourceMetadata() |
compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, get, getOrDefault, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAll, size
equals, hashCode, toString
public static final String RESOLUTION_PATH
public static final String RESOLUTION_PATH_INFO
sling.resolutionPath
property returns the
original request URI leading to the resource.
This property is optional. If missing, it should be assumed equal to an empty string.
public static final String CONTENT_TYPE
public static final String CONTENT_LENGTH
Note, that unlike the other properties, this property may be set only
after the resource has successfully been adapted to an
InputStream
for performance reasons.
public static final String CHARACTER_ENCODING
public static final String CREATION_TIME
java.lang.Long
. The property may be missing if the
resource is not streamable or if the creation time is not known.public static final String MODIFICATION_TIME
java.lang.Long
. The property may be missing
if the resource is not streamable or if the last modification time is not
known.public static final String INTERNAL_CONTINUE_RESOLVING
public static final String PARAMETER_MAP
/content/test;v='1.2.3'.html
will contain one entry key v
and value 1.2.3
.public void setCharacterEncoding(String encoding)
encoding
- The encoding@CheckForNull public String getCharacterEncoding()
CHARACTER_ENCODING
property if not null
and a String
instance. Otherwise null
is
returned.public void setContentType(String contentType)
contentType
- The content type@CheckForNull public String getContentType()
public void setContentLength(long contentLength)
contentLength
- The content lengthpublic long getContentLength()
public void setCreationTime(long creationTime)
CREATION_TIME
property to creationTime
if not negative.creationTime
- The creation timepublic long getCreationTime()
public void setModificationTime(long modificationTime)
MODIFICATION_TIME
property to
modificationTime
if not negative.modificationTime
- The modification timepublic long getModificationTime()
public void setResolutionPath(String resolutionPath)
resolutionPath
- The resolution path@CheckForNull public String getResolutionPath()
public void setResolutionPathInfo(String resolutionPathInfo)
resolutionPathInfo
- The resolution path info@CheckForNull public String getResolutionPathInfo()
RESOLUTION_PATH_INFO
property if not
null
and a String
instance. Otherwise
null
is returned.public void setParameterMap(Map<String,String> parameterMap)
parameterMap
- The parameter map@CheckForNull public Map<String,String> getParameterMap()
public void lock()
public void clear()
Copyright © 2017 The Apache Software Foundation. All rights reserved.