use of fi.otavanopisto.muikku.schooldata.SchoolDataBridgeException in project muikku by otavanopisto.
the class PyramusRestClient method delete.
public void delete(Client client, String accssToken, String path) {
WebTarget target = client.target(url + path);
Builder request = target.request();
request.header("Authorization", "Bearer " + accssToken);
Response response = request.delete();
try {
switch(response.getStatus()) {
case 200:
case 204:
case 404:
break;
case 403:
logger.warning(String.format("Pyramus DELETE for path %s unauthorized (%d)", path, response.getStatus()));
throw new SchoolDataBridgeUnauthorizedException(String.format("Received http error %d when requesting %s", response.getStatus(), path));
default:
logger.warning(String.format("Pyramus DELETE for path %s failed (%d)", path, response.getStatus()));
throw new SchoolDataBridgeException(response.getStatus(), String.format("Received http error %d (%s) when requesting %s", response.getStatus(), response.getEntity(), path));
}
} finally {
response.close();
}
}
Aggregations