@ SuppressWarnings ( "PMD.PreserveStackTrace" ) public JSONAware extractJsonResponse ( HttpResponse pHttpResponse ) throws IOException , ParseException { HttpEntity entity = pHttpResponse . getEntity ( ) ; try { JSONParser parser = new JSONParser ( ) ; Header contentEncoding = entity . getContentEncoding ( ) ; if ( contentEncoding != null ) { return ( JSONAware ) parser . parse ( new InputStreamReader ( entity . getContent ( ) , Charset . forName ( contentEncoding . getValue ( ) ) ) ) ; } else { return ( JSONAware ) parser . parse ( new InputStreamReader ( entity . getContent ( ) ) ) ; } } finally { if ( entity != null ) { EntityUtils . consume ( entity ) ; } } }
Extract the complete JSON response out of a HTTP response