List of utility methods to do HttpResponse Read
boolean | readBody(HttpResponse resp, ByteBuffer target) read Body final HttpEntity entity = resp.getEntity(); if (entity == null) { throw new IllegalArgumentException( "HTTP entity may not be null"); final InputStream is = entity.getContent(); if (is == null) { return false; ... |
JSONObject | decodeJSONResponse(HttpResponse resp) decode JSON Response InputStream is = null; try { is = resp.getEntity().getContent(); } catch (IOException e) { Log.d(TAG, "unable to get content from response entity"); e.printStackTrace(); return null; String in = convertStreamToString(is); JSONObject json = null; try { json = new JSONObject(in); } catch (JSONException e) { Log.d(TAG, "could not decode JSON response from: " + in); return json; |
Map | handleJsonResponse(HttpResponse response) handle Json Response JSONObject oauthLoginResponse = null; String contentType = response.getEntity().getContentType() .getValue(); try { oauthLoginResponse = new JSONObject( EntityUtils.toString(response.getEntity())); } catch (ParseException e1) { e1.printStackTrace(); ... |