Class MultiStatusResponse

  • All Implemented Interfaces:
    DavConstants, XmlSerializable

    public class MultiStatusResponse
    extends java.lang.Object
    implements XmlSerializable, DavConstants
    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 >
     
    • Constructor Detail

      • MultiStatusResponse

        public MultiStatusResponse​(java.lang.String href,
                                   Status status,
                                   java.lang.String responseDescription)
        Constructs an WebDAV multistatus response
        Parameters:
        href -
        status -
        responseDescription -
      • MultiStatusResponse

        public MultiStatusResponse​(java.lang.String href,
                                   int statusCode)
        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 to null.
        Parameters:
        href -
        statusCode -
      • MultiStatusResponse

        public MultiStatusResponse​(java.lang.String href,
                                   int statusCode,
                                   java.lang.String responseDescription)
        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

        public MultiStatusResponse​(java.lang.String href,
                                   java.lang.String responseDescription)
        Constructs an empty WebDAV multistatus response of type 'PropStat'
      • MultiStatusResponse

        public MultiStatusResponse​(DavResource resource,
                                   DavPropertyNameSet propNameSet)
        Constructs a WebDAV multistatus response and retrieves the resource properties according to the given DavPropertyNameSet.
        Parameters:
        resource -
        propNameSet -
    • Method Detail

      • getHref

        public java.lang.String getHref()
        Returns the href
        Returns:
        href
        See Also:
        getHref()
      • getResponseDescription

        public java.lang.String getResponseDescription()
        Returns:
        responseDescription
        See Also:
        getResponseDescription()
      • getStatus

        public Status[] getStatus()
        Return an array listing all 'status' available is this response object. Note, that a the array contains a single element if this MultiStatusResponse 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

        public org.w3c.dom.Element toXml​(org.w3c.dom.Document document)
        Description copied from interface: XmlSerializable
        Returns the xml representation of the implementing object as Element. The given Document is used as factory and represents the owner document of the returned DOM element.
        Specified by:
        toXml in interface XmlSerializable
        Parameters:
        document -
        Returns:
        a w3c element representing this object
        See Also:
        XmlSerializable.toXml(org.w3c.dom.Document)
      • 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. In case this MultiStatusResponse does not represent a 'propstat' response, always an empty DavPropertySet will be returned.
        Parameters:
        status -
        Returns:
        property set
      • getPropertyNames

        public DavPropertyNameSet getPropertyNames​(int status)
        Get property names present in this response for the given status code. In case this MultiStatusResponse does not represent a 'propstat' response, always an empty DavPropertyNameSet will be returned.
        Parameters:
        status -
        Returns:
        property names
      • createFromXml

        public static MultiStatusResponse createFromXml​(org.w3c.dom.Element responseElement)
        Build a new response object from the given xml element.
        Parameters:
        responseElement -
        Returns:
        new MultiStatusResponse instance
        Throws:
        java.lang.IllegalArgumentException - if the specified element is null or not a DAV:response element or if the mandatory DAV:href child is missing.