public class ExceptionHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
ExceptionHandler() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deserializeAndThrowException(org.apache.http.HttpResponse response) |
static void |
deserializeAndThrowException(InputStream errorStream,
String contentType,
Integer statusCode,
String reason)
Throw the exception that is contained in an HTTP response
A response from an HTTP call may be determined to have an error.
|
static void |
deserializeHeadersAndThrowException(int code,
org.apache.http.Header[] headers) |
protected static <T> T |
deserializeServiceType(Class<T> domainClass,
InputStream is)
Wrapper for Marshalling method that recasts exceptions
to ServiceFailure;
|
static <T> BaseException |
deserializeXml(InputStream errorStream,
String defaultMessage) |
static InputStream |
filterErrors(org.apache.http.HttpResponse res) |
static InputStream |
filterErrors(org.apache.http.HttpResponse response,
boolean allowRedirects)
This method maps an HttpResponse onto an InputStream by consuming the
response headers and throwing an exception when appropriate.
|
static InputStream |
filterErrors(InputStream is,
boolean isException,
String contentType) |
static org.apache.http.Header[] |
filterErrorsHeader(org.apache.http.HttpResponse response,
String httpMethod)
will filter serialized errors coming from the HEAD request
by deserializing them and putting on the exception thread(?).
|
public static InputStream filterErrors(org.apache.http.HttpResponse res) throws AuthenticationTimeout, IdentifierNotUnique, InsufficientResources, InvalidCredentials, InvalidRequest, InvalidSystemMetadata, InvalidToken, NotAuthorized, NotFound, NotImplemented, ServiceFailure, UnsupportedMetadataType, UnsupportedType, VersionMismatch, IllegalStateException, IOException, org.apache.http.HttpException, SynchronizationFailed
AuthenticationTimeoutIdentifierNotUniqueInsufficientResourcesInvalidCredentialsInvalidRequestInvalidSystemMetadataInvalidTokenNotAuthorizedNotFoundNotImplementedServiceFailureUnsupportedMetadataTypeUnsupportedTypeVersionMismatchIllegalStateExceptionIOExceptionorg.apache.http.HttpExceptionSynchronizationFailedpublic static InputStream filterErrors(org.apache.http.HttpResponse response, boolean allowRedirects) throws AuthenticationTimeout, IdentifierNotUnique, InsufficientResources, InvalidCredentials, InvalidRequest, InvalidSystemMetadata, InvalidToken, NotAuthorized, NotFound, NotImplemented, ServiceFailure, UnsupportedMetadataType, UnsupportedType, VersionMismatch, IllegalStateException, IOException, org.apache.http.HttpException, SynchronizationFailed
response - allowRedirects - - if true, does not throw exceptions for status codes of 3xxAuthenticationTimeoutIdentifierNotUniqueInsufficientResourcesInvalidCredentialsInvalidRequestInvalidSystemMetadataInvalidTokenNotAuthorizedNotFoundNotImplementedServiceFailureUnsupportedMetadataTypeUnsupportedTypeVersionMismatchIllegalStateExceptionIOExceptionorg.apache.http.HttpExceptionSynchronizationFailedpublic static org.apache.http.Header[] filterErrorsHeader(org.apache.http.HttpResponse response,
String httpMethod)
throws AuthenticationTimeout,
IdentifierNotUnique,
InsufficientResources,
InvalidCredentials,
InvalidRequest,
InvalidSystemMetadata,
InvalidToken,
NotAuthorized,
NotFound,
NotImplemented,
ServiceFailure,
UnsupportedMetadataType,
UnsupportedType,
VersionMismatch,
IllegalStateException,
IOException,
org.apache.http.HttpException,
SynchronizationFailed
response - - the http responseAuthenticationTimeoutIdentifierNotUniqueInsufficientResourcesInvalidCredentialsInvalidRequestInvalidSystemMetadataInvalidTokenNotAuthorizedNotFoundNotImplementedServiceFailureUnsupportedMetadataTypeUnsupportedQueryTypeUnsupportedTypeVersionMismatchIllegalStateExceptionIOExceptionorg.apache.http.HttpExceptionSynchronizationFailedpublic static void deserializeHeadersAndThrowException(int code,
org.apache.http.Header[] headers)
throws AuthenticationTimeout,
IdentifierNotUnique,
InsufficientResources,
InvalidCredentials,
InvalidRequest,
InvalidSystemMetadata,
InvalidToken,
NotAuthorized,
NotFound,
NotImplemented,
ServiceFailure,
UnsupportedMetadataType,
UnsupportedType,
VersionMismatch,
IllegalStateException,
IOException,
org.apache.http.HttpException,
SynchronizationFailed
AuthenticationTimeoutIdentifierNotUniqueInsufficientResourcesInvalidCredentialsInvalidRequestInvalidSystemMetadataInvalidTokenNotAuthorizedNotFoundNotImplementedServiceFailureUnsupportedMetadataTypeUnsupportedTypeVersionMismatchIllegalStateExceptionIOExceptionorg.apache.http.HttpExceptionSynchronizationFailedpublic static InputStream filterErrors(InputStream is, boolean isException, String contentType) throws AuthenticationTimeout, IdentifierNotUnique, InsufficientResources, InvalidCredentials, InvalidRequest, InvalidSystemMetadata, InvalidToken, NotAuthorized, NotFound, NotImplemented, ServiceFailure, UnsupportedMetadataType, UnsupportedType, VersionMismatch, IllegalStateException, IOException, SynchronizationFailed
AuthenticationTimeoutIdentifierNotUniqueInsufficientResourcesInvalidCredentialsInvalidRequestInvalidSystemMetadataInvalidTokenNotAuthorizedNotFoundNotImplementedServiceFailureUnsupportedMetadataTypeUnsupportedTypeVersionMismatchIllegalStateExceptionIOExceptionSynchronizationFailedpublic static void deserializeAndThrowException(org.apache.http.HttpResponse response)
throws NotFound,
InvalidToken,
ServiceFailure,
NotAuthorized,
NotFound,
IdentifierNotUnique,
UnsupportedType,
InsufficientResources,
InvalidSystemMetadata,
NotImplemented,
InvalidCredentials,
InvalidRequest,
IOException,
AuthenticationTimeout,
UnsupportedMetadataType,
VersionMismatch,
org.apache.http.HttpException,
SynchronizationFailed
response - NotFoundInvalidTokenServiceFailureNotAuthorizedNotFoundIdentifierNotUniqueUnsupportedTypeInsufficientResourcesInvalidSystemMetadataNotImplementedInvalidCredentialsInvalidRequestIOExceptionAuthenticationTimeoutUnsupportedMetadataTypeVersionMismatchorg.apache.http.HttpExceptionSynchronizationFailedpublic static void deserializeAndThrowException(InputStream errorStream, String contentType, Integer statusCode, String reason) throws AuthenticationTimeout, IdentifierNotUnique, InsufficientResources, InvalidCredentials, InvalidRequest, InvalidSystemMetadata, InvalidToken, NotAuthorized, NotFound, NotImplemented, ServiceFailure, UnsupportedMetadataType, UnsupportedType, SynchronizationFailed, VersionMismatch
errorStream - contentType - NotFoundInvalidTokenServiceFailureNotAuthorizedNotFoundIdentifierNotUniqueUnsupportedTypeInsufficientResourcesInvalidSystemMetadataNotImplementedInvalidCredentialsInvalidRequestIOExceptionAuthenticationTimeoutUnsupportedMetadataTypeUnsupportedQueryTypeVersionMismatchorg.apache.http.HttpExceptionSynchronizationFailedpublic static <T> BaseException deserializeXml(InputStream errorStream, String defaultMessage) throws ParserConfigurationException, SAXException, IOException
protected static <T> T deserializeServiceType(Class<T> domainClass, InputStream is) throws ServiceFailure
type - the class of the object to serialize (i.e.
SystemMetadata.class)is - the stream to deserialize fromServiceFailureCopyright © 2020. All Rights Reserved.