Android StatusLine - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android StatusLine class.

This code example shows how to use the following methods:getReasonPhrase, getStatusCode
//      request.addHeader("x-wap-profile", "http://www.htcmms.com.tw/Android/Common/nexusone/ua-profile.xml"); 
      request.addHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml");
      HttpResponse response = client.execute(target, request);
      StatusLine status     = response.getStatusLine();
 
      if (status.getStatusCode() != 200)
        throw new IOException("Non-successful HTTP response: " + status.getReasonPhrase());
 
      return parseResponse(response.getEntity());
    } catch (URISyntaxException use) {
      Log.w("MmsSendHelper", use);
      throw new IOException("Couldn't parse URI.");
    } finally { 
      if (client != null)
        client.close();
    } 
  } 
 
  public static SendConf sendMms(Context context, byte[] mms, String apn,
                                 boolean usingMmsRadio, boolean useProxyIfAvailable)
8
CodeRank
This code example shows how to use the following methods:getStatusCode
                    "x-wap-profile", 
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"); 
 
            HttpResponse response = client.execute(req);
            StatusLine status = response.getStatusLine();
            if (status.getStatusCode() != 200) { // HTTP 200 is success.
                if (DEBUG) Log.d(TAG, "HTTP error: " + status.getReasonPhrase());
                return null; 
            } 
 
            HttpEntity entity = response.getEntity();
            byte[] body = null;
            if (entity != null) {
                try { 
                    if (entity.getContentLength() > 0) {
                        body = new byte[(int) entity.getContentLength()];
                        DataInputStream dis = new DataInputStream(entity.getContent());
                        try { 
                            dis.readFully(body);
                        } finally { 
7
CodeRank
This code example shows how to use the following methods:getReasonPhrase, getStatusCode
    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;
 

6
CodeRank
This code example shows how to use the following methods:getReasonPhrase, getStatusCode
            responseBody = EntityUtils.toString(entity,"UTF-8");
        } catch(IOException e) {
            sendFailureMessage(e, null);
        } 
 
        if(status.getStatusCode() >= 300) {
            sendFailureMessage(new HttpResponseException(status.getStatusCode(), status.getReasonPhrase()), responseBody);
        } else { 
            sendSuccessMessage(responseBody);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getReasonPhrase
    /** 
     * @return The HTTP status message from the server 
     */ 
    public String getHttpStatusMessage ()
    { 
        return httpStatusLine == null ? null : httpStatusLine.getReasonPhrase();
    } 
 
    /** 
     * @return The version of HTTP used. 
     */ 
    public String getHttpVersion ()
    { 
        return httpStatusLine == null ? null : httpStatusLine.getProtocolVersion().toString(); 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:getStatusCode
                    "x-wap-profile", 
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"); 
 
            HttpResponse response = client.execute(req);
            StatusLine status = response.getStatusLine();
            if (status.getStatusCode() != 200) { // HTTP 200 is success.
                if (DEBUG) Log.d(TAG, "HTTP error: " + status.getReasonPhrase());
                return null; 
            } 
 
            HttpEntity entity = response.getEntity();
            byte[] body = null;
            if (entity != null) {
                try { 
                    if (entity.getContentLength() > 0) {
                        body = new byte[(int) entity.getContentLength()];
                        DataInputStream dis = new DataInputStream(entity.getContent());
                        try { 
                            dis.readFully(body);
                        } finally { 
6
CodeRank
This code example shows how to use the following methods:getReasonPhrase, getStatusCode
                    "x-wap-profile", 
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"); 
 
            HttpResponse response = client.execute(req);
            StatusLine status = response.getStatusLine();
            if (status.getStatusCode() != 200) { // HTTP 200 is success.
                if (Config.LOGD) Log.d(TAG, "HTTP error: " + status.getReasonPhrase());
                return null; 
            } 
 
            HttpEntity entity = response.getEntity();
            byte[] body = null;
            if (entity != null) {
                try { 
                    if (entity.getContentLength() > 0) {
                        body = new byte[(int) entity.getContentLength()];
                        DataInputStream dis = new DataInputStream(entity.getContent());
                        try { 
                            dis.readFully(body);
                        } finally { 
6
CodeRank
This code example shows how to use the following methods:getReasonPhrase, getStatusCode
            } 
        } catch(IOException e) {
            sendFailureMessage(e, (String) null);
        } 
 
        if(status.getStatusCode() >= 300) {
            sendFailureMessage(new HttpResponseException(status.getStatusCode(), status.getReasonPhrase()), responseBody);
        } else { 
            sendSuccessMessage(status.getStatusCode(), responseBody);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getStatusCode
                request = new HttpDelete(url);
            } 
            setHeader(method, request, params, url, token);
            HttpResponse response = client.execute(request);
            StatusLine status = response.getStatusLine();
            int statusCode = status.getStatusCode();
 
            if (statusCode != 200) {
                result = read(response);
                String err = null;
                int errCode = 0;
				try { 
					JSONObject json = new JSONObject(result);
					err = json.getString("error");
					errCode = json.getInt("error_code");
				} catch (JSONException e) {
					e.printStackTrace();
				} 
				throw new WeiboException(String.format(err), errCode);
            } 
6
CodeRank
This code example shows how to use the following methods:getReasonPhrase, getStatusCode
               InvalidClientException, InvalidGrantException, 
               UnauthorizedClientException, UnsupportedGrantTypeException, 
               InvalidScopeException, OAuthException { 
 
        StatusLine statusLine = this.httpResponse.getStatusLine();
        this.statusCode = statusLine.getStatusCode();
        try { 
            getStringEntity(); 
        } catch (IOException ex) {
            Logger.getLogger(Response.class.getName()).log(Level.SEVERE, null, ex);
        } 
 
        if (parseStringEntityForJson()) { 
            JsonParser.parseForErrors(jsonResponse);
        } else if (parseStringEntityForParameters()) { 
        } 
 
        switch (statusCode) {
            case (200): { 
                return true; 

6
CodeRank

Related Android StatusLine Questions & Answers:

See Code Examples for Android StatusLine Methods: