org.apache.jackrabbit.webdav
Class MultiStatusResponse

java.lang.Object
  extended byorg.apache.jackrabbit.webdav.MultiStatusResponse
All Implemented Interfaces:
DavConstants

public class MultiStatusResponse
extends Object
implements DavConstants

The WebdavMultistatusResponse class implements a structure that hold a WebDAV multistatus response. Properties can be added to this response with the respective error/status code.


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, NO_OVERWRITE, 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_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, 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
MultiStatusResponse(DavResource resource, DavPropertyNameSet propNameSet)
          Constucts a WebDAV multistatus response and retrieves the resource properties according to the given DavPropertyNameSet.
MultiStatusResponse(DavResource resource, DavPropertyNameSet propNameSet, int propFindType)
          Constucts a WebDAV multistatus response and retrieves the resource properties according to the given DavPropertyNameSet.
MultiStatusResponse(String href)
          Constructs an empty WebDAV multistatus response
MultiStatusResponse(String href, int status)
          Constructs an WebDAV multistatus response for a given resource.
 
Method Summary
 void add(DavProperty property)
          Adds a property to this response '200' propstat set.
 void add(DavProperty property, int status)
          Adds a property to this response
 void 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 response
static MultiStatusResponse createFromXml(org.jdom.Element responseElement)
          Build a new response object from the given xml element.
 String getHref()
          Returns the href
 DavPropertySet getProperties(int status)
          Get properties present in this response for the given status code.
 DavPropertyNameSet getPropertyNames(int status)
          Get property names present in this response for the given status code.
 String getResponseDescription()
           
 void setResponseDescription(String responseDescription)
          Set the content of the optional response description element, which is intended to contain a message that can be displayed to the user explaining the nature of this response.
 org.jdom.Element toXml()
          Creates the JDOM element for this reponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiStatusResponse

public MultiStatusResponse(String href)
Constructs an empty WebDAV multistatus response


MultiStatusResponse

public MultiStatusResponse(DavResource resource,
                           DavPropertyNameSet propNameSet)
Constucts a WebDAV multistatus response and retrieves the resource properties according to the given DavPropertyNameSet.

Parameters:
resource -
propNameSet -

MultiStatusResponse

public MultiStatusResponse(DavResource resource,
                           DavPropertyNameSet propNameSet,
                           int propFindType)
Constucts a WebDAV multistatus response and retrieves the resource properties according to the given DavPropertyNameSet. 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 and DavConstants.PROPFIND_PROPERTY_NAMES propFindType.

Parameters:
resource - The resource to retrieve the property from
propNameSet - 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

MultiStatusResponse

public MultiStatusResponse(String href,
                           int status)
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.

Method Detail

getHref

public String getHref()
Returns the href

Returns:
href

add

public void add(DavProperty property)
Adds a property to this response '200' propstat set.

Parameters:
property - the property to add

add

public void add(DavPropertyName propertyName)
Adds a property name to this response '200' propstat set.

Parameters:
propertyName - the property name to add

add

public void add(DavProperty property,
                int status)
Adds a property to this response

Parameters:
property - the property to add
status - the status of the response set to select

add

public void add(DavPropertyName propertyName,
                int status)
Adds a property name to this response

Parameters:
propertyName - the property name to add
status - the status of the response set to select

getProperties

public DavPropertySet getProperties(int status)
Get properties present in this response for the given status code.

Parameters:
status -
Returns:
property set

getPropertyNames

public DavPropertyNameSet getPropertyNames(int status)
Get property names present in this response for the given status code.

Parameters:
status -
Returns:
property names

getResponseDescription

public String getResponseDescription()
Returns:
responseDescription

setResponseDescription

public void setResponseDescription(String responseDescription)
Set the content of the optional response description element, which is intended to contain a message that can be displayed to the user explaining the nature of this response.

Parameters:
responseDescription -

toXml

public org.jdom.Element toXml()
Creates the JDOM element for this reponse.

Returns:
A JDOM element of this response

createFromXml

public static MultiStatusResponse createFromXml(org.jdom.Element responseElement)
Build a new response object from the given xml element.

Parameters:
responseElement -
Returns:
new MultiStatusResponse instance
Throws:
IllegalArgumentException - if the specified element is null


Copyright © 2005 . All Rights Reserved.