Code example for StatusLine

Methods: getReasonPhrasegetStatusCode

0
    private Object handleResponse(HttpResponse response) throws HttpException, IOException {
        if (response == null) {
            throw new HttpException("response is null");
        } 
        StatusLine status = response.getStatusLine();
        int statusCode = status.getStatusCode();
        if (statusCode < 300) {
            HttpEntity entity = response.getEntity();
            Object responseBody = null;
            if (entity != null) {
                lastUpdateTime = SystemClock.uptimeMillis();
                if (isDownloadingFile) {
                    String responseFileName = autoRename ? OtherUtils.getFileNameFromHttpResponse(response) : null;
                    responseBody = mFileDownloadHandler.handleEntity(entity, this, fileSavePath, autoResume, responseFileName);
                } else { 
 
                    // Set charset from response header info if it's exist. 
                    String responseCharset = OtherUtils.getCharsetFromHttpResponse(response);
                    charset = TextUtils.isEmpty(responseCharset) ? charset : responseCharset;
 
                    responseBody = mStringDownloadHandler.handleEntity(entity, this, charset);
                    HttpUtils.sHttpGetCache.put(_getRequestUrl, (String) responseBody, expiry);
                } 
            } 
            return responseBody;
        } else if (statusCode == 301 || statusCode == 302) {
            if (downloadRedirectHandler == null) {
                downloadRedirectHandler = new DefaultDownloadRedirectHandler();
            } 
            HttpRequestBase request = downloadRedirectHandler.getDirectRequest(response);
            if (request != null) {
                return this.sendRequest(request);
            } 
        } else if (statusCode == 416) {
            throw new HttpException(statusCode, "maybe the file has downloaded completely");
        } else { 
            throw new HttpException(statusCode, status.getReasonPhrase());
        } 
        return null; 
    } 
 
    private boolean mStop = false;
Connect your IDE to all the code out there  Get Codota for Java