Class DavException

  • All Implemented Interfaces:
    java.io.Serializable, XmlSerializable

    public class DavException
    extends java.lang.Exception
    implements XmlSerializable
    DavException extends the Exception class in order to simplify handling of exceptional situations occurring during processing of WebDAV requests and provides possibility to retrieve an Xml representation of the error.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String XML_ERROR  
    • Constructor Summary

      Constructors 
      Constructor Description
      DavException​(int errorCode)
      Create a new DavException.
      DavException​(int errorCode, java.lang.String message)
      Create a new DavException.
      DavException​(int errorCode, java.lang.String message, java.lang.Throwable cause, org.w3c.dom.Element errorCondition)
      Create a new DavException.
      DavException​(int errorCode, java.lang.Throwable cause)
      Create a new DavException.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getErrorCode()
      Return the error code attached to this DavException.
      org.w3c.dom.Element getErrorCondition()
      Return the error condition attached to this DavException.
      java.lang.String getStatusPhrase()
      Return the status phrase corresponding to the error code attached to this DavException.
      static java.lang.String getStatusPhrase​(int errorCode)
      Returns the status phrase for the given error code.
      boolean hasErrorCondition()  
      org.w3c.dom.Element toXml​(org.w3c.dom.Document document)
      Returns a DAV:error element containing the error condition or null if no specific condition is available.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DavException

        public DavException​(int errorCode,
                            java.lang.String message,
                            java.lang.Throwable cause,
                            org.w3c.dom.Element errorCondition)
        Create a new DavException.
        Parameters:
        errorCode - integer specifying any of the status codes defined by DavServletResponse.
        message - Human readable error message.
        cause - Cause of this DavException.
        errorCondition - Xml element providing detailed information about the error. If the condition is not null, toXml(Document)
    • Method Detail

      • getErrorCode

        public int getErrorCode()
        Return the error code attached to this DavException.
        Returns:
        errorCode
      • getStatusPhrase

        public java.lang.String getStatusPhrase()
        Return the status phrase corresponding to the error code attached to this DavException.
        Returns:
        status phrase corresponding to the error code.
        See Also:
        getErrorCode()
      • getStatusPhrase

        public static java.lang.String getStatusPhrase​(int errorCode)
        Returns the status phrase for the given error code.
        Parameters:
        errorCode -
        Returns:
        status phrase corresponding to the given error code.
      • hasErrorCondition

        public boolean hasErrorCondition()
        Returns:
        true if a error condition has been specified, false otherwise.
      • getErrorCondition

        public org.w3c.dom.Element getErrorCondition()
        Return the error condition attached to this DavException.
        Returns:
        errorCondition
      • toXml

        public org.w3c.dom.Element toXml​(org.w3c.dom.Document document)
        Returns a DAV:error element containing the error condition or null if no specific condition is available. See RFC 3253 Section 1.6 "Method Preconditions and Postconditions" for additional information.
        Specified by:
        toXml in interface XmlSerializable
        Parameters:
        document -
        Returns:
        A DAV:error element indicating the error cause or null.
        See Also:
        XmlSerializable.toXml(Document)