use of uk.ac.ebi.spot.goci.exception.EnsemblRestClientException in project goci by EBISPOT.
the class EnsemblRestTemplateService method exec.
public RestResponseResult exec(String url) {
ResponseEntity<String> out;
RestResponseResult result = new RestResponseResult();
RestTemplate restTemplate = this.getRestTemplate();
HttpEntity<Object> entity = this.getEntity();
getLog().debug("Querying " + url);
//and do I need this JSON media type for my use case?
try {
out = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
result.setStatus(out.getStatusCode().value());
result.setUrl(url);
JsonNode body = new JsonNode(out.getBody().toString());
result.setRestResult(body);
getLog().debug("Response: 200");
//result.setValue(out.getBody());
} catch (EnsemblRestClientException erce) {
getLog().debug("EnsemblRestClientException");
result = erce.getEnsemblLookup();
result.setUrl(url);
} catch (Exception e) {
getLog().debug("Exception not managed");
}
return result;
}
Aggregations