- @SuppressWarnings("unchecked")
- public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) {
-
- String methodName = "Delete";
- String url = "";
- Response cres;
-
- try {
- initRestClient();
-
- url = SchedulerProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path;
-
- cres = client.target(url).request().accept(APPLICATION_JSON).headers(commonHeaders)
- // .entity(r)
- .build("DELETE", Entity.entity(requestDetails, MediaType.APPLICATION_JSON)).invoke();
-
- int status = cres.getStatus();
- restObject.setStatusCode(status);
- if (cres.getEntity() != null) {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
-
- } catch (HttpClientErrorException e) {
- logger.error(EELFLoggerDelegate.errorLogger, " HttpClientErrorException:Exception For the Delete",
- methodName, url, e);
- EPLogUtil.schedulerAccessAlarm(logger, e.getStatusCode().value());
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Exception For the Delete", methodName, url, e);
- EPLogUtil.schedulerAccessAlarm(logger, HttpStatus.INTERNAL_SERVER_ERROR.value());
- throw e;
- }
- }