Class HttpResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.google.api.client.http.HttpResponseException
- All Implemented Interfaces:
Serializable
Exception thrown when an error status code is detected in an HTTP response.
Implementation is not thread safe.
- Since:
- 1.0
- Author:
- Yaniv Inbar
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionHttpResponseException(HttpResponse response) Constructor that constructs a detail message from the given HTTP response that includes the status code, status message and HTTP response content.protected -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuildercomputeMessageBuffer(HttpResponse response) Returns an exception message string builder to use for the given HTTP response.final intReturns the attempt countfinal StringReturns the HTTP response content ornullfor none.Returns the HTTP response headers.final intReturns the HTTP status code or0for none.final StringReturns the HTTP status message ornullfor none.final booleanReturns whether received a successful HTTP status code>= 200 && < 300(seegetStatusCode()).Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
HttpResponseException
Constructor that constructs a detail message from the given HTTP response that includes the status code, status message and HTTP response content.Callers of this constructor should call
HttpResponse.disconnect()afterHttpResponseExceptionis instantiated. Example usage:try { throw new HttpResponseException(response); } finally { response.disconnect(); }- Parameters:
response- HTTP response
-
HttpResponseException
- Parameters:
builder- builder- Since:
- 1.14
-
-
Method Details
-
isSuccessStatusCode
public final boolean isSuccessStatusCode()Returns whether received a successful HTTP status code>= 200 && < 300(seegetStatusCode()).- Since:
- 1.7
-
getStatusCode
public final int getStatusCode()Returns the HTTP status code or0for none.- Since:
- 1.7
-
getStatusMessage
-
getHeaders
-
getContent
-
getAttemptCount
public final int getAttemptCount()Returns the attempt count- Since:
- 1.41
-
computeMessageBuffer
Returns an exception message string builder to use for the given HTTP response.- Since:
- 1.7
-