have a class that handles Http requests for me. This class contains some methods like
public static String getServerResponseByHttpGet(String url){...}
public static String getServerResponseByHttpGet(String url, String token){...}
public static String getServerResponseByHttpPost(String url, token, List<NameValuePair> pairs){...}
I'm able to get connection code by using httpResponse.getStatusLine().getStatusCode();
Since I need to handle different situations like if connection code is 401, 403, 04, 409, etc. then I want to throw this code and catch it in implementation class. Is it possible to do that. I have following class but have no idea how to modify it in order to send integer value.
public class MyHttpClientException extends Exception {
public MyHttpClientException() {
}
public MyHttpClientException(String message) {
super(message);
}
public MyHttpClientException (Throwable cause) {
super (cause);
}
public MyHttpClientException (String message, Throwable cause) {
super (message, cause);
}
}