@Override public ChannelQueryResult channelQuery(String queryUri) { try { return httpClient.get( SimpleHttpRequest.httpRequestFrom( queryUri, new HttpResponseTransformer<ChannelQueryResult>() { @Override public ChannelQueryResult transform(HttpResponsePrologue prologue, InputStream body) throws HttpException, Exception { return gson.get() .fromJson( new InputStreamReader(body, Charsets.UTF_8), ChannelQueryResult.class); } })); } catch (Exception e) { throw new RuntimeException("Problem with channel query " + queryUri, e); } }
@Override public EventQueryResult eventQuery(String eventQueryUri) { try { return httpClient.get( SimpleHttpRequest.httpRequestFrom( eventQueryUri, new HttpResponseTransformer<EventQueryResult>() { @Override public EventQueryResult transform( HttpResponsePrologue httpResponsePrologue, InputStream inputStream) throws HttpException, Exception { return gson.get() .fromJson( new InputStreamReader(inputStream, Charsets.UTF_8), EventQueryResult.class); } })); } catch (Exception e) { throw new RuntimeException("Problem with event query" + eventQueryUri, e); } }