use of org.commonjava.indy.client.core.IndyResponseErrorDetails in project indy by Commonjava.
the class IndyFoloAdminClientModule method sealTrackingRecord.
public boolean sealTrackingRecord(String trackingId) throws IndyClientException {
http.connect();
HttpPost request = http.newRawPost(UrlUtils.buildUrl(http.getBaseUrl(), "/folo/admin", trackingId, "record"));
HttpResources resources = null;
try {
resources = http.execute(request);
HttpResponse response = resources.getResponse();
StatusLine sl = response.getStatusLine();
if (sl.getStatusCode() != 200) {
if (sl.getStatusCode() == 404) {
return false;
}
throw new IndyClientException(sl.getStatusCode(), "Error sealing tracking record %s.\n%s", trackingId, new IndyResponseErrorDetails(response));
}
return true;
} finally {
IOUtils.closeQuietly(resources);
}
}
use of org.commonjava.indy.client.core.IndyResponseErrorDetails in project indy by Commonjava.
the class IndyDiagnosticsClientModule method getDiagnosticBundle.
public ZipInputStream getDiagnosticBundle() throws IndyClientException {
HttpGet get = new HttpGet(buildUrl(getHttp().getBaseUrl(), "/diag/bundle"));
HttpResources resources = getHttp().getRaw(get);
HttpResponse response = resources.getResponse();
StatusLine sl = response.getStatusLine();
if (sl.getStatusCode() != 200) {
throw new IndyClientException(sl.getStatusCode(), "Error retrieving diagnostic bundle: %s", new IndyResponseErrorDetails(response));
}
try {
return new ZipInputStream(resources.getResponseStream());
} catch (IOException e) {
throw new IndyClientException("Failed to read bundle stream from response: %s", e, new IndyResponseErrorDetails(response));
}
}
Aggregations