org.jets3t.service
Class S3ServiceException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.jets3t.service.S3ServiceException
All Implemented Interfaces:
Serializable

public class S3ServiceException
extends Exception

Exception for use by S3Services and related utilities. This exception can hold useful additional information about errors that occur when communicating with S3.

Author:
James Murty
See Also:
Serialized Form

Constructor Summary
S3ServiceException()
           
S3ServiceException(String message)
           
S3ServiceException(String message, String xmlMessage)
          Constructor that includes the XML error document returned by S3.
S3ServiceException(String message, Throwable cause)
           
S3ServiceException(Throwable cause)
           
 
Method Summary
 String getRequestHost()
           
 String getRequestPath()
           
 String getRequestVerb()
           
 int getResponseCode()
           
 String getResponseDate()
           
 Map getResponseHeaders()
           
 String getResponseStatus()
           
 String getS3ErrorCode()
           
 String getS3ErrorHostId()
           
 String getS3ErrorMessage()
           
 String getS3ErrorRequestId()
           
 String getXmlMessage()
           
 boolean isParsedFromXmlMessage()
           
 void setRequestHost(String requestHost)
           
 void setRequestPath(String requestPath)
           
 void setRequestVerb(String requestVerb)
           
 void setResponseCode(int responseCode)
           
 void setResponseDate(String responseDate)
           
 void setResponseHeaders(Map s3Headers)
           
 void setResponseStatus(String responseStatus)
           
 void setS3RequestAndHostIds(String errorRequestId, String errorHostId)
          Allow the S3 Request and Host Id fields to be populated in situations where this information is not available from an XML response error document.
 String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

S3ServiceException

public S3ServiceException(String message,
                          String xmlMessage)
Constructor that includes the XML error document returned by S3.

Parameters:
message -
xmlMessage -

S3ServiceException

public S3ServiceException()

S3ServiceException

public S3ServiceException(String message,
                          Throwable cause)

S3ServiceException

public S3ServiceException(String message)

S3ServiceException

public S3ServiceException(Throwable cause)
Method Detail

toString

public String toString()
Overrides:
toString in class Throwable

getS3ErrorCode

public String getS3ErrorCode()
Returns:
The service-specific Error Code returned by S3, if an S3 response is available. For example "AccessDenied", "InternalError" Null otherwise.

getS3ErrorMessage

public String getS3ErrorMessage()
Returns:
The service-specific Error Message returned by S3, if an S3 response is available. For example: "Access Denied", "We encountered an internal error. Please try again."

getS3ErrorHostId

public String getS3ErrorHostId()
Returns:
The Error Host ID returned by S3, if an S3 response is available. Null otherwise.

getS3ErrorRequestId

public String getS3ErrorRequestId()
Returns:
The Error Request ID returned by S3, if an S3 response is available. Null otherwise.

getXmlMessage

public String getXmlMessage()
Returns:
The XML Error message returned by S3, if an S3 response is available. Null otherwise.

isParsedFromXmlMessage

public boolean isParsedFromXmlMessage()

getResponseCode

public int getResponseCode()
Returns:
The HTTP Response Code returned by S3, if an HTTP response is available. For example: 401, 404, 500

setResponseCode

public void setResponseCode(int responseCode)

getResponseStatus

public String getResponseStatus()
Returns:
The HTTP Status message returned by S3, if an HTTP response is available. For example: "Forbidden", "Not Found", "Internal Server Error"

setResponseStatus

public void setResponseStatus(String responseStatus)

getResponseDate

public String getResponseDate()

setResponseDate

public void setResponseDate(String responseDate)

getRequestVerb

public String getRequestVerb()
Returns:
The HTTP Verb used in the request, if available. For example: "GET", "PUT", "DELETE"

setRequestVerb

public void setRequestVerb(String requestVerb)

getRequestPath

public String getRequestPath()

setRequestPath

public void setRequestPath(String requestPath)

getRequestHost

public String getRequestHost()

setRequestHost

public void setRequestHost(String requestHost)

setS3RequestAndHostIds

public void setS3RequestAndHostIds(String errorRequestId,
                                   String errorHostId)
Allow the S3 Request and Host Id fields to be populated in situations where this information is not available from an XML response error document. If there is no XML error response document, the RequestId and HostId will generally be available as the HTTP response headers x-amz-request-id and x-amz-id-2 respectively.

Parameters:
errorRequestId -
errorHostId -

getResponseHeaders

public Map getResponseHeaders()

setResponseHeaders

public void setResponseHeaders(Map s3Headers)