private String getResponseMessage(HttpClientException clientException) { try { StringBuilder builder = new StringBuilder(); RestResponse restResponse = ResourceDTOFactory.get(clientException.getMessage()); for (Message message : restResponse.getMessages()) { builder.append(message.toString()).append('\n'); } return builder.toString(); } catch (OpenShiftException e) { // unexpected json content LOGGER.error(e.getMessage()); return clientException.getMessage(); } catch (IllegalArgumentException e) { // not json return clientException.getMessage(); } }
public RestResponse request(Link link, Map<String, Object> parameters) throws OpenShiftException { validateParameters(parameters, link); HttpMethod httpMethod = link.getHttpMethod(); String response = request(link.getHref(), httpMethod, parameters); return ResourceDTOFactory.get(response); }