- String content = "";
- try {
- content = GsonUtil.beanToJson(ruleCreateRequest);
- } catch (Exception e) {
- throw new CorrelationException("Failed to convert the message object to a json string.", e);
- }
- HashMap<String, String> headers = new HashMap<>();
- headers.put("Content-Type", MediaType.APPLICATION_JSON);
- headers.put("Accept", MediaType.APPLICATION_JSON);
- HttpResponse httpResponse;
- try {
- httpResponse = HttpsUtils
- .put(url, headers, new HashMap<>(), new StringEntity(content));
- } catch (UnsupportedEncodingException e) {
- throw new CorrelationException("Failed to create https entity.", e);
- } catch (Exception e) {
- throw new CorrelationException(e.getMessage());
- }
- if (httpResponse != null) {
- suc = httpResponse.getStatusLine().getStatusCode() == 200;
- }
+ suc = JerseyClient.newInstance().header("Accept", MediaType.APPLICATION_JSON)
+ .put(url, Entity.json(ruleCreateRequest)) != null;
+