// Path: framework/util/http/HttpApiWithBasicAuth.java
// public class HttpApiWithBasicAuth extends AbstractHttpApi {
// 
//     private HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
// 
//         @Override
//         public void process(final HttpRequest request, final HttpContext context)
//                 throws HttpException, IOException {
// 
//             AuthState authState = (AuthState) context
//                     .getAttribute(ClientContext.TARGET_AUTH_STATE);
//             CredentialsProvider credsProvider = (CredentialsProvider) context
//                     .getAttribute(ClientContext.CREDS_PROVIDER);
//             HttpHost targetHost = (HttpHost) context
//                     .getAttribute(ExecutionContext.HTTP_TARGET_HOST);
// 
//             // If not auth scheme has been initialized yet
//             if (authState.getAuthScheme() == null) {
//                 AuthScope authScope = new AuthScope(targetHost.getHostName(),
//                         targetHost.getPort());
//                 // Obtain credentials matching the target host
//                 org.apache.http.auth.Credentials creds = credsProvider
//                         .getCredentials(authScope);
//                 // If found, generate BasicScheme preemptively
//                 if (creds != null) {
//                     authState.setAuthScheme(new BasicScheme());
//                     authState.setCredentials(creds);
//                 }
//             }
//         }
// 
//     };
// 
//     public HttpApiWithBasicAuth(DefaultHttpClient httpClient,
//             String clientVersion) {
//         super(httpClient, clientVersion);
//         httpClient.addRequestInterceptor(preemptiveAuth, 0);
//     }
// }
// 
// Path: framework/util/http/exception/AuthorizationException.java
// public class AuthorizationException extends XmlParserException {
//     private static final long serialVersionUID = 1L;
// 
//     public AuthorizationException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: framework/util/http/exception/XmlParserException.java
// public class XmlParserException extends Exception {
//     
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3789211073927189813L;
//     private String mExtra;
// 
//     public XmlParserException(String errorMessage) {
//         super(errorMessage);
//     }
// 
//     public XmlParserException(String errorMessage, String extra) {
//         super(errorMessage);
//         mExtra = extra;
//     }
//     
//     public String getExtra() {
//         return mExtra;
//     }
// }
// 
// Path: framework/util/http/exception/XmlParserParseException.java
// public class XmlParserParseException extends XmlParserException {
// 
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3857089504256300868L;
// 
//     public XmlParserParseException(String errorMessage) {
//         super(errorMessage);
//     }
// }


import com.elphin.framework.util.http.HttpApiWithBasicAuth;
import com.elphin.framework.util.http.exception.AuthorizationException;
import com.elphin.framework.util.http.exception.XmlParserException;
import com.elphin.framework.util.http.exception.XmlParserParseException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
//                 is = UserController.getIS();
                return analysisInputStreamToObject(is, parser, encodeing);
            } catch (JSONException e) {
                throw new XmlParserException(response.getStatusLine().toString(), EntityUtils.toString(response
                        .getEntity()));
            } catch (Exception e) {
                throw new XmlParserException(response.getStatusLine().toString(), EntityUtils.toString(response
                        .getEntity()));
            } finally {
                is.close();
            }

        case 400:
            throw new XmlParserException(response.getStatusLine().toString(),
                    EntityUtils.toString(response.getEntity()));

        case 401:
            response.getEntity().consumeContent();
            throw new AuthorizationException(response.getStatusLine().toString());

        case 404:
            response.getEntity().consumeContent();
            throw new XmlParserException(response.getStatusLine().toString());

        case 500:
            response.getEntity().consumeContent();
            throw new XmlParserException("Internal Server Error");

        default:
            response.getEntity().consumeContent();
// Path: framework/util/http/HttpApiWithBasicAuth.java
// public class HttpApiWithBasicAuth extends AbstractHttpApi {
// 
//     private HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
// 
//         @Override
//         public void process(final HttpRequest request, final HttpContext context)
//                 throws HttpException, IOException {
// 
//             AuthState authState = (AuthState) context
//                     .getAttribute(ClientContext.TARGET_AUTH_STATE);
//             CredentialsProvider credsProvider = (CredentialsProvider) context
//                     .getAttribute(ClientContext.CREDS_PROVIDER);
//             HttpHost targetHost = (HttpHost) context
//                     .getAttribute(ExecutionContext.HTTP_TARGET_HOST);
// 
//             // If not auth scheme has been initialized yet
//             if (authState.getAuthScheme() == null) {
//                 AuthScope authScope = new AuthScope(targetHost.getHostName(),
//                         targetHost.getPort());
//                 // Obtain credentials matching the target host
//                 org.apache.http.auth.Credentials creds = credsProvider
//                         .getCredentials(authScope);
//                 // If found, generate BasicScheme preemptively
//                 if (creds != null) {
//                     authState.setAuthScheme(new BasicScheme());
//                     authState.setCredentials(creds);
//                 }
//             }
//         }
// 
//     };
// 
//     public HttpApiWithBasicAuth(DefaultHttpClient httpClient,
//             String clientVersion) {
//         super(httpClient, clientVersion);
//         httpClient.addRequestInterceptor(preemptiveAuth, 0);
//     }
// }
// 
// Path: framework/util/http/exception/AuthorizationException.java
// public class AuthorizationException extends XmlParserException {
//     private static final long serialVersionUID = 1L;
// 
//     public AuthorizationException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: framework/util/http/exception/XmlParserException.java
// public class XmlParserException extends Exception {
//     
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3789211073927189813L;
//     private String mExtra;
// 
//     public XmlParserException(String errorMessage) {
//         super(errorMessage);
//     }
// 
//     public XmlParserException(String errorMessage, String extra) {
//         super(errorMessage);
//         mExtra = extra;
//     }
//     
//     public String getExtra() {
//         return mExtra;
//     }
// }
// 
// Path: framework/util/http/exception/XmlParserParseException.java
// public class XmlParserParseException extends XmlParserException {
// 
//     /**
//      * 
//      */
//     private static final long serialVersionUID = 3857089504256300868L;
// 
//     public XmlParserParseException(String errorMessage) {
//         super(errorMessage);
//     }
// }


// Path: framework/util/jsonparser/JsonParserHttpApi.java
import com.elphin.framework.util.http.HttpApiWithBasicAuth;
import com.elphin.framework.util.http.exception.AuthorizationException;
import com.elphin.framework.util.http.exception.XmlParserException;
import com.elphin.framework.util.http.exception.XmlParserParseException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;

//                 is = UserController.getIS();
                return analysisInputStreamToObject(is, parser, encodeing);
            } catch (JSONException e) {
                throw new XmlParserException(response.getStatusLine().toString(), EntityUtils.toString(response
                        .getEntity()));
            } catch (Exception e) {
                throw new XmlParserException(response.getStatusLine().toString(), EntityUtils.toString(response
                        .getEntity()));
            } finally {
                is.close();
            }

        case 400:
            throw new XmlParserException(response.getStatusLine().toString(),
                    EntityUtils.toString(response.getEntity()));

        case 401:
            response.getEntity().consumeContent();
            throw new AuthorizationException(response.getStatusLine().toString());

        case 404:
            response.getEntity().consumeContent();
            throw new XmlParserException(response.getStatusLine().toString());

        case 500:
            response.getEntity().consumeContent();
            throw new XmlParserException("Internal Server Error");

        default:
            response.getEntity().consumeContent();
            throw new XmlParserException("Error connecting : " + statusCode + ". Try again later.");