1 package org.ksoap2.transport; 2 3 import java.io.IOException; 4 import java.util.List; 5 6 /** 7 * HttpResponseException is an IOException that is to be thrown when a Http response code is 8 * different from 200. 9 * It allows for easier retrieval of the Http response code from the connection. 10 * 11 * @author Rui Pereira <syshex@gmail.com> 12 */ 13 public class HttpResponseException extends IOException { 14 15 private int statusCode; 16 private List responseHeaders; 17 HttpResponseException(int statusCode)18 public HttpResponseException(int statusCode) { 19 super(); 20 this.statusCode = statusCode; 21 } 22 HttpResponseException(String detailMessage, int statusCode)23 public HttpResponseException(String detailMessage, int statusCode) { 24 super(detailMessage); 25 this.statusCode = statusCode; 26 } 27 HttpResponseException(String detailMessage, int statusCode, List responseHeaders)28 public HttpResponseException(String detailMessage, int statusCode, List responseHeaders) { 29 super(detailMessage); 30 this.statusCode = statusCode; 31 this.responseHeaders = responseHeaders; 32 } 33 HttpResponseException(String message, Throwable cause, int statusCode)34 public HttpResponseException(String message, Throwable cause, int statusCode) { 35 super(message, cause); 36 this.statusCode = statusCode; 37 } 38 HttpResponseException(Throwable cause, int statusCode)39 public HttpResponseException(Throwable cause, int statusCode) { 40 super(cause); 41 this.statusCode = statusCode; 42 } 43 44 /** 45 * Returns the unexpected Http response code 46 * 47 * @return response code 48 */ getStatusCode()49 public int getStatusCode() { 50 return statusCode; 51 } 52 53 /** 54 * Returns all http headers from this response 55 * 56 * @return response code 57 */ getResponseHeaders()58 public List getResponseHeaders() { 59 return responseHeaders; 60 } 61 } 62