public class ResourceMetadata
extends java.util.HashMap<java.lang.String,java.lang.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!
Modifier and Type | Field and Description |
---|---|
static java.lang.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 java.lang.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 java.lang.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 java.lang.String |
CREATION_TIME
Returns the creation time of this resource in the repository in
milliseconds (value is "sling.creationTime").
|
static java.lang.String |
INTERNAL_CONTINUE_RESOLVING
Deprecated.
This flag is not supported anymore when implementing the SPI
based
org.apache.sling.spi.resource.provider.ResourceProvider |
static java.lang.String |
MODIFICATION_TIME
Returns the last modification time of this resource in the repository in
milliseconds (value is "sling.modificationTime").
|
static java.lang.String |
PARAMETER_MAP
Returns a map containing parameters added to path after semicolon.
|
static java.lang.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 java.lang.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() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
java.lang.Object |
clone() |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
java.lang.String |
getCharacterEncoding()
|
long |
getContentLength()
|
java.lang.String |
getContentType()
|
long |
getCreationTime()
|
long |
getModificationTime()
|
java.util.Map<java.lang.String,java.lang.String> |
getParameterMap()
|
java.lang.String |
getResolutionPath()
|
java.lang.String |
getResolutionPathInfo()
|
java.util.Set<java.lang.String> |
keySet() |
void |
lock()
Make this object read-only.
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m) |
java.lang.Object |
remove(java.lang.Object key) |
void |
setCharacterEncoding(java.lang.String encoding)
|
void |
setContentLength(long contentLength)
|
void |
setContentType(java.lang.String contentType)
|
void |
setCreationTime(long creationTime)
Sets the
CREATION_TIME property to creationTime
if not negative. |
void |
setModificationTime(long modificationTime)
Sets the
MODIFICATION_TIME property to
modificationTime if not negative. |
void |
setParameterMap(java.util.Map<java.lang.String,java.lang.String> parameterMap)
|
void |
setResolutionPath(java.lang.String resolutionPath)
|
void |
setResolutionPathInfo(java.lang.String resolutionPathInfo)
|
java.util.Collection<java.lang.Object> |
values() |
public static final java.lang.String RESOLUTION_PATH
public static final java.lang.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 java.lang.String CONTENT_TYPE
public static final java.lang.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 java.lang.String CHARACTER_ENCODING
public static final java.lang.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 java.lang.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 java.lang.String INTERNAL_CONTINUE_RESOLVING
org.apache.sling.spi.resource.provider.ResourceProvider
public static final java.lang.String PARAMETER_MAP
/content/test;v='1.2.3'.html
will contain one entry key v
and value 1.2.3
.public void setCharacterEncoding(java.lang.String encoding)
encoding
- The encodingpublic java.lang.String getCharacterEncoding()
CHARACTER_ENCODING
property if not null
and a String
instance. Otherwise null
is
returned.public void setContentType(java.lang.String contentType)
contentType
- The content typepublic java.lang.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(java.lang.String resolutionPath)
resolutionPath
- The resolution pathpublic java.lang.String getResolutionPath()
public void setResolutionPathInfo(java.lang.String resolutionPathInfo)
resolutionPathInfo
- The resolution path infopublic java.lang.String getResolutionPathInfo()
RESOLUTION_PATH_INFO
property if not
null
and a String
instance. Otherwise
null
is returned.public void setParameterMap(java.util.Map<java.lang.String,java.lang.String> parameterMap)
parameterMap
- The parameter mappublic java.util.Map<java.lang.String,java.lang.String> getParameterMap()
public void lock()
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
clear
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in class java.util.HashMap<java.lang.String,java.lang.Object>
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
putAll
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
remove
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.lang.Object clone()
clone
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
entrySet
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
keySet
in class java.util.HashMap<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
values
in class java.util.HashMap<java.lang.String,java.lang.Object>
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"