org.apache.jackrabbit.webdav
Class DavException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.apache.jackrabbit.webdav.DavException
All Implemented Interfaces:
Serializable, XmlSerializable
Direct Known Subclasses:
JcrDavException

public class DavException
extends Exception
implements XmlSerializable

DavException extends the Exception class in order to simplify handling of exceptional situations occuring during processing of WebDAV requests and provides possibility to retrieve an Xml representation of the error.

See Also:
Serialized Form

Field Summary
static String XML_ERROR
           
 
Constructor Summary
DavException(int errorCode)
          Create a new DavException.
DavException(int errorCode, String message)
          Create a new DavException.
DavException(int errorCode, String message, Throwable cause, Element errorCondition)
          Create a new DavException.
DavException(int errorCode, Throwable cause)
          Create a new DavException.
 
Method Summary
 int getErrorCode()
          Return the error code attached to this DavException.
 String getStatusPhrase()
          Return the status phrase corresponding to the error code attached to this DavException.
static String getStatusPhrase(int errorCode)
          Returns the status phrase for the given error code.
 boolean hasErrorCondition()
           
 Element toXml(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
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_ERROR

public static final String XML_ERROR
See Also:
Constant Field Values
Constructor Detail

DavException

public DavException(int errorCode,
                    String message)
Create a new DavException.

Parameters:
errorCode - integer specifying any of the status codes defined by DavServletResponse.
message - Human readable error message.
See Also:
DavException(int, String, Throwable, Element)

DavException

public DavException(int errorCode,
                    Throwable cause)
Create a new DavException.

Parameters:
errorCode - integer specifying any of the status codes defined by DavServletResponse.
cause - Cause of this DavException
See Also:
DavException(int, String, Throwable, Element)

DavException

public DavException(int errorCode)
Create a new DavException.

Parameters:
errorCode - integer specifying any of the status codes defined by DavServletResponse.
See Also:
DavException(int, String, Throwable, Element)

DavException

public DavException(int errorCode,
                    String message,
                    Throwable cause,
                    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 detailled 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 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 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.

toXml

public Element toXml(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)


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.