Package org.apache.jackrabbit.webdav
Class MultiStatusResponse
java.lang.Object
org.apache.jackrabbit.webdav.MultiStatusResponse
- All Implemented Interfaces:
DavConstants
,XmlSerializable
MultiStatusResponse
represents the DAV:multistatus element defined
by RFC 2518:
<!ELEMENT response (href, ((href*, status)|(propstat+)), responsedescription?) > <!ELEMENT status (#PCDATA) > <!ELEMENT propstat (prop, status, responsedescription?) > <!ELEMENT responsedescription (#PCDATA) > <!ELEMENT prop ANY >
-
Field Summary
Fields inherited from interface org.apache.jackrabbit.webdav.DavConstants
creationDateFormat, DEPTH_0, DEPTH_1, DEPTH_INFINITY, DEPTH_INFINITY_S, HEADER_AUTHORIZATION, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_DAV, HEADER_DEPTH, HEADER_DESTINATION, HEADER_ETAG, HEADER_IF, HEADER_LAST_MODIFIED, HEADER_LOCK_TOKEN, HEADER_OVERWRITE, HEADER_TIMEOUT, INFINITE_TIMEOUT, modificationDateFormat, NAMESPACE, OPAQUE_LOCK_TOKEN_PREFIX, PROPERTY_CREATIONDATE, PROPERTY_DISPLAYNAME, PROPERTY_GETCONTENTLANGUAGE, PROPERTY_GETCONTENTLENGTH, PROPERTY_GETCONTENTTYPE, PROPERTY_GETETAG, PROPERTY_GETLASTMODIFIED, PROPERTY_LOCKDISCOVERY, PROPERTY_RESOURCETYPE, PROPERTY_SOURCE, PROPERTY_SUPPORTEDLOCK, PROPFIND_ALL_PROP, PROPFIND_ALL_PROP_INCLUDE, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIME, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_INCLUDE, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKROOT, XML_LOCKSCOPE, XML_LOCKTOKEN, XML_LOCKTYPE, XML_MULTISTATUS, XML_OMIT, XML_OWNER, XML_PROP, XML_PROPERTYBEHAVIOR, XML_PROPERTYUPDATE, XML_PROPFIND, XML_PROPNAME, XML_PROPSTAT, XML_REMOVE, XML_RESPONSE, XML_RESPONSEDESCRIPTION, XML_SET, XML_SHARED, XML_SOURCE, XML_STATUS, XML_TIMEOUT, XML_WRITE
-
Constructor Summary
ConstructorsConstructorDescriptionMultiStatusResponse
(String href, int statusCode) Constructs an WebDAV multistatus response for a given resource.MultiStatusResponse
(String href, int statusCode, String responseDescription) Constructs an WebDAV multistatus response for a given resource.MultiStatusResponse
(String href, String responseDescription) Constructs an empty WebDAV multistatus response of type 'PropStat'MultiStatusResponse
(String href, Status status, String responseDescription) Constructs an WebDAV multistatus responseMultiStatusResponse
(DavResource resource, DavPropertyNameSet propNameSet) Constructs a WebDAV multistatus response and retrieves the resource properties according to the givenDavPropertyNameSet
.MultiStatusResponse
(DavResource resource, DavPropertyNameSet propNameSet, int propFindType) Constructs a WebDAV multistatus response and retrieves the resource properties according to the givenDavPropertyNameSet
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(DavProperty<?> property) Adds a property to this response '200' propstat set.void
add
(DavProperty<?> property, int status) Adds a property to this responsevoid
add
(DavPropertyName propertyName) Adds a property name to this response '200' propstat set.void
add
(DavPropertyName propertyName, int status) Adds a property name to this responsestatic MultiStatusResponse
createFromXml
(Element responseElement) Build a new response object from the given xml element.getHref()
Returns the hrefgetProperties
(int status) Get properties present in this response for the given status code.getPropertyNames
(int status) Get property names present in this response for the given status code.Status[]
Return an array listing all 'status' available is this response object.boolean
Returns the xml representation of the implementing object asElement
.
-
Constructor Details
-
MultiStatusResponse
Constructs an WebDAV multistatus response- Parameters:
href
-status
-responseDescription
-
-
MultiStatusResponse
Constructs an WebDAV multistatus response for a given resource. This would be used by COPY, MOVE, DELETE, LOCK that require a multistatus in case of error with a resource other than the resource identified in the Request-URI.
The response description is set tonull
.- Parameters:
href
-statusCode
-
-
MultiStatusResponse
Constructs an WebDAV multistatus response for a given resource. This would be used by COPY, MOVE, DELETE, LOCK that require a multistatus in case of error with a resource other than the resource identified in the Request-URI.- Parameters:
href
-statusCode
-responseDescription
-
-
MultiStatusResponse
Constructs an empty WebDAV multistatus response of type 'PropStat' -
MultiStatusResponse
Constructs a WebDAV multistatus response and retrieves the resource properties according to the givenDavPropertyNameSet
.- Parameters:
resource
-propNameSet
-
-
MultiStatusResponse
Constructs a WebDAV multistatus response and retrieves the resource properties according to the givenDavPropertyNameSet
. It adds all known property to the '200' set, while unknown properties are added to the '404' set.Note, that the set of property names is ignored in case of a
DavConstants.PROPFIND_ALL_PROP
andDavConstants.PROPFIND_PROPERTY_NAMES
propFindType.- Parameters:
resource
- The resource to retrieve the property frompropNameSet
- The property name set as obtained from the request body.propFindType
- any of the following values:DavConstants.PROPFIND_ALL_PROP
,DavConstants.PROPFIND_BY_PROPERTY
,DavConstants.PROPFIND_PROPERTY_NAMES
,DavConstants.PROPFIND_ALL_PROP_INCLUDE
-
-
Method Details
-
getHref
Returns the href- Returns:
- href
- See Also:
-
getResponseDescription
- Returns:
- responseDescription
- See Also:
-
getStatus
Return an array listing all 'status' available is this response object. Note, that a the array contains a single element if thisMultiStatusResponse
defines an response consisting of href and status elements.- Returns:
-
isPropStat
public boolean isPropStat()- Returns:
true
if the response is of type "propstat" (containing information about individual properties)
-
toXml
Description copied from interface:XmlSerializable
Returns the xml representation of the implementing object asElement
. The givenDocument
is used as factory and represents theowner document
of the returned DOM element.- Specified by:
toXml
in interfaceXmlSerializable
- Parameters:
document
-- Returns:
- a w3c element representing this object
- See Also:
-
add
Adds a property to this response '200' propstat set.- Parameters:
property
- the property to add
-
add
Adds a property name to this response '200' propstat set.- Parameters:
propertyName
- the property name to add
-
add
Adds a property to this response- Parameters:
property
- the property to addstatus
- the status of the response set to select
-
add
Adds a property name to this response- Parameters:
propertyName
- the property name to addstatus
- the status of the response set to select
-
getProperties
Get properties present in this response for the given status code. In case this MultiStatusResponse does not represent a 'propstat' response, always an emptyDavPropertySet
will be returned.- Parameters:
status
-- Returns:
- property set
-
getPropertyNames
Get property names present in this response for the given status code. In case this MultiStatusResponse does not represent a 'propstat' response, always an emptyDavPropertyNameSet
will be returned.- Parameters:
status
-- Returns:
- property names
-
createFromXml
Build a new response object from the given xml element.- Parameters:
responseElement
-- Returns:
- new
MultiStatusResponse
instance - Throws:
IllegalArgumentException
- if the specified element isnull
or not a DAV:response element or if the mandatory DAV:href child is missing.
-