com.ibm.xdms.exception.xcap
Class XcapException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by javax.servlet.ServletException
              extended by com.ibm.xdms.exception.XdmsException
                  extended by com.ibm.xdms.exception.xcap.XcapException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CannotDeleteException, CannotInsertException, ConstraintFailureException, LocalConstraintFailureException, NoParentException, NotUtf8Exception, NotWellFormedException, NotXmlAttributeValueException, NotXmlFragmentException, SchemaValidationException, UnauthorizedException, UniquenessFailureException, UnsupportedMediaTypeException

public class XcapException
extends XdmsException

Top level XCAP Exception class

See Also:
Serialized Form

Field Summary
protected static java.lang.String BASE_ERROR_DOC
          Base error document
protected static java.lang.String BASE_ERROR_DOC_PREFIX
          Base error document prefix
protected static java.lang.String BASE_ERROR_DOC_SUFFIX
          Base error document suffix
static java.lang.String CONTENT_TYPE_XCAP_ERROR
          Error content type
protected  java.lang.Object errorDocumentLock
          Document lock object
protected static java.util.logging.Logger LOGGER
          Logger
 
Fields inherited from class com.ibm.xdms.exception.XdmsException
hasSetResponse
 
Constructor Summary
XcapException(int statusCode)
          Constructor, uses the default content type of application/xcap-error+xml and returns no error document
XcapException(int statusCode, java.lang.String elementTag)
          Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag
XcapException(int statusCode, java.lang.String elementTag, java.lang.String attributeName, java.lang.String attributeValue)
          Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag and its associated attribute
XcapException(java.lang.String namespace, int statusCode, java.lang.String elementTag)
          Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag
XcapException(java.lang.String namespace, int statusCode, java.lang.String elementTag, java.lang.String attributeName, java.lang.String attributeValue)
          Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag and its associated attribute
 
Method Summary
protected  org.w3c.dom.Document createBaseErrorDocument()
          Forms the base error document in which other exceptions may append their respective error elements
 java.lang.String getContentType()
          Retrieves the HTTP Content Type
 org.w3c.dom.Document getErrorDocument()
          Returns the error document associated with this exception.
 java.lang.String getErrorDocumentAsString()
          Returns the error document as a String
 int getStatusCode()
          Returns the HTTP status code
 void setErrorElement(java.lang.String elementTag)
          Set a simple response with the given tag
 void setErrorElement(java.lang.String elementTag, java.lang.String attributeName, java.lang.String attributeValue)
          Set a simple response with the given tag and attribute
 void setErrorElementNS(java.lang.String namespace, java.lang.String elementTag)
          Set a simple response with the given tag
 void setErrorElementNS(java.lang.String namespace, java.lang.String elementTag, java.lang.String attributeName, java.lang.String attributeValue)
          Set a simple response with the given tag and attribute
 void setupResponse(XcapServerResponse xcapResponse)
          Sets up the response based on the XcapException
 
Methods inherited from class com.ibm.xdms.exception.XdmsException
createLocalizedMessage, createLocalizedXdmsException, createServerMessage, createServerXdmsException, setupResponse
 
Methods inherited from class javax.servlet.ServletException
getRootCause
 
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

BASE_ERROR_DOC_PREFIX

protected static final java.lang.String BASE_ERROR_DOC_PREFIX
Base error document prefix

See Also:
Constant Field Values

BASE_ERROR_DOC_SUFFIX

protected static final java.lang.String BASE_ERROR_DOC_SUFFIX
Base error document suffix

See Also:
Constant Field Values

BASE_ERROR_DOC

protected static final java.lang.String BASE_ERROR_DOC
Base error document

See Also:
Constant Field Values

CONTENT_TYPE_XCAP_ERROR

public static final java.lang.String CONTENT_TYPE_XCAP_ERROR
Error content type

See Also:
Constant Field Values

errorDocumentLock

protected java.lang.Object errorDocumentLock
Document lock object


LOGGER

protected static final java.util.logging.Logger LOGGER
Logger

Constructor Detail

XcapException

public XcapException(int statusCode)
Constructor, uses the default content type of application/xcap-error+xml and returns no error document

Parameters:
statusCode - HTTP Response Code which should be returned to the client

XcapException

public XcapException(int statusCode,
                     java.lang.String elementTag)
Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag

Parameters:
statusCode - HTTP Response Code which should be returned to the client
elementTag - Element tag name

XcapException

public XcapException(java.lang.String namespace,
                     int statusCode,
                     java.lang.String elementTag)
Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag

Parameters:
namespace - The namespace of the element
statusCode - HTTP Response Code which should be returned to the client
elementTag - Element tag name

XcapException

public XcapException(int statusCode,
                     java.lang.String elementTag,
                     java.lang.String attributeName,
                     java.lang.String attributeValue)
Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag and its associated attribute

Parameters:
statusCode - HTTP Response Code which should be returned to the client
elementTag - Element tag name
attributeName - Attribute Name
attributeValue - Attribute Value

XcapException

public XcapException(java.lang.String namespace,
                     int statusCode,
                     java.lang.String elementTag,
                     java.lang.String attributeName,
                     java.lang.String attributeValue)
Constructor, uses the default content type of application/xcap-error+xml and returns an error document with a single error tag and its associated attribute

Parameters:
namespace - The namespace of the element
statusCode - HTTP Response Code which should be returned to the client
elementTag - Element tag name
attributeName - Attribute Name
attributeValue - Attribute Value
Method Detail

getErrorDocument

public org.w3c.dom.Document getErrorDocument()
Returns the error document associated with this exception.

Returns:
Returns the error document associated with this exception.

getErrorDocumentAsString

public java.lang.String getErrorDocumentAsString()
Returns the error document as a String

Returns:
Returns the error document as a String

createBaseErrorDocument

protected org.w3c.dom.Document createBaseErrorDocument()
Forms the base error document in which other exceptions may append their respective error elements

Returns:
Base Error Document DOM, null if there was an error creating the docment (should not happen!!!!)

getStatusCode

public int getStatusCode()
Returns the HTTP status code

Returns:
HTTP status code

setErrorElement

public void setErrorElement(java.lang.String elementTag)
Set a simple response with the given tag

Parameters:
elementTag - Element tag name

setErrorElement

public void setErrorElement(java.lang.String elementTag,
                            java.lang.String attributeName,
                            java.lang.String attributeValue)
Set a simple response with the given tag and attribute

Parameters:
elementTag - Element tag name
attributeName - Attribute Name
attributeValue - Attribute Value

setErrorElementNS

public void setErrorElementNS(java.lang.String namespace,
                              java.lang.String elementTag)
Set a simple response with the given tag

Parameters:
namespace - The namespace of the element
elementTag - Element tag name

setErrorElementNS

public void setErrorElementNS(java.lang.String namespace,
                              java.lang.String elementTag,
                              java.lang.String attributeName,
                              java.lang.String attributeValue)
Set a simple response with the given tag and attribute

Parameters:
namespace - The namespace of the element
elementTag - Element tag name
attributeName - Attribute Name
attributeValue - Attribute Value

getContentType

public java.lang.String getContentType()
Retrieves the HTTP Content Type

Returns:
HTTP Content Type

setupResponse

public void setupResponse(XcapServerResponse xcapResponse)
                   throws java.io.IOException
Sets up the response based on the XcapException

Overrides:
setupResponse in class XdmsException
Parameters:
xcapResponse - XcapServerResponse
Throws:
java.io.IOException