public class HttpException extends IOException
IOException for http exceptions because HttpURLConnection throws un-discerned IOException and
it can help to know the http response code to decide how to handle an http exceptions.| Constructor and Description |
|---|
HttpException(int responseCode,
String responseMessage,
String url,
Throwable cause)
Instantiates a new Http exception.
|
HttpException(int responseCode,
String responseMessage,
URL url,
Throwable cause)
Instantiates a new Http exception.
|
HttpException(String message,
int responseCode,
String responseMessage,
String url)
Instantiates a new Http exception.
|
HttpException(String message,
int responseCode,
String responseMessage,
String url,
Throwable cause)
Instantiates a new Http exception.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getResponseCode()
Http response code of the request that cause the exception
|
String |
getResponseMessage()
Http response message of the request that cause the exception
|
String |
getUrl()
The http URL that caused the exception
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic HttpException(String message, int responseCode, String responseMessage, String url)
message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method)responseCode - Http response code. -1 if no code can be discerned.responseMessage - Http response messageurl - The url that was invokedHttpURLConnection#getResponseCode(),
HttpURLConnection#getResponseMessage()public HttpException(String message, int responseCode, String responseMessage, String url, Throwable cause)
message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method)responseCode - Http response code. -1 if no code can be discerned.responseMessage - Http response messageurl - The url that was invokedcause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is
permitted, and indicates that the cause is nonexistent or unknown.)HttpURLConnection#getResponseCode(),
HttpURLConnection#getResponseMessage()public HttpException(int responseCode,
String responseMessage,
String url,
Throwable cause)
responseCode - Http response code. -1 if no code can be discerned.responseMessage - Http response messageurl - The url that was invokedcause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is
permitted, and indicates that the cause is nonexistent or unknown.)HttpURLConnection#getResponseCode(),
HttpURLConnection#getResponseMessage()public HttpException(int responseCode,
String responseMessage,
@CheckForNull
URL url,
Throwable cause)
responseCode - Http response code. -1 if no code can be discerned.responseMessage - Http response messageurl - The url that was invokedcause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is
permitted, and indicates that the cause is nonexistent or unknown.)HttpURLConnection#getResponseCode(),
HttpURLConnection#getResponseMessage()public int getResponseCode()
-1 if no code can be discerned.public String getResponseMessage()
null if no response message can be discerned.public String getUrl()
Copyright © 2020. All rights reserved.