Package io.avaje.http.client
Class HttpException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.avaje.http.client.HttpException
-
- All Implemented Interfaces:
Serializable
public class HttpException extends RuntimeException
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HttpException(int statusCode, String message)
HttpException(int statusCode, String message, Throwable cause)
HttpException(int statusCode, Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
bean(Class<T> cls)
Return the response body content as a beanbyte[]
bodyAsBytes()
Return the response body content as raw bytes.String
bodyAsString()
Return the response body content as a UTF8 string.HttpResponse<?>
getHttpResponse()
Return the underlying HttpResponse.int
getStatusCode()
Return the HTTP status code.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
bean
public <T> T bean(Class<T> cls)
Return the response body content as a bean- Parameters:
cls
- The type of bean to convert the response to- Returns:
- The response as a bean
-
bodyAsString
public String bodyAsString()
Return the response body content as a UTF8 string.
-
bodyAsBytes
public byte[] bodyAsBytes()
Return the response body content as raw bytes.
-
getStatusCode
public int getStatusCode()
Return the HTTP status code.
-
getHttpResponse
public HttpResponse<?> getHttpResponse()
Return the underlying HttpResponse.
-
-