/** * Parses error response. * * @param response parsed <tt>ErrorResponse</tt> * @return <tt>ErrorResponse</tt> parsed from HTTP content stream. * @throws IOException if any IO issues occur. * @throws ParseException if any issues with JSON parsing occur. */ private ErrorResponse readErrorResponse(HttpResponse response) throws IOException, ParseException { BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); jsonParser.parse(rd, errorJson); return errorJson.getResult(); }
/** * Parses JSON string returned in HTTP response and converts it to <tt>Conference</tt> instance. * * @param conference <tt>Conference</tt> instance that contains the data returned by API endpoint. * @param response HTTP response returned by the API endpoint. * @return <tt>Conference</tt> instance that contains the data returned by API endpoint. * @throws IOException if any IO problems occur. * @throws ParseException if any problems with JSON parsing occur. */ private Conference readConferenceResponse(Conference conference, HttpResponse response) throws IOException, ParseException { BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); if (conference != null) { conferenceJson.setForUpdate(conference); } jsonParser.parse(rd, conferenceJson); if (conference == null) { conference = conferenceJson.getResult(); } logger.info("ID: " + conference.getId()); logger.info("PIN: " + conference.getPin()); logger.info("URL: " + conference.getUrl()); logger.info("SIP ID: " + conference.getSipId()); logger.info("START TIME: " + conference.getStartTime()); logger.info("DURATION: " + conference.getDuration()); return conference; }