private void parseResponse ( HttpResponse response ) throws MPException { this . statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; this . reasonPhrase = response . getStatusLine ( ) . getReasonPhrase ( ) ; if ( response . getEntity ( ) != null ) { HttpEntity respEntity = response . getEntity ( ) ; try { this . stringResponse = MPCoreUtils . inputStreamToString ( respEntity . getContent ( ) ) ; } catch ( Exception ex ) { throw new MPException ( ex ) ; } // Try to parse the response to a json, and a extract the entity of the response. // When the response is not a json parseable string then the string response must be used. try { this . jsonElementResponse = new JsonParser ( ) . parse ( this . stringResponse ) ; } catch ( JsonParseException jsonParseException ) { // Do nothing } } }
Parses the http response in a custom MPApiResponse object .