@Override public String request(String href, HttpMethod httpMethod, int timeout, IMediaType mediaType, Map<String, Object> parameters) throws OpenShiftException { URL url = getUrl(href); try { return request(url, httpMethod, timeout, mediaType, parameters); } catch (EncodingException e) { throw new OpenShiftException(e, e.getMessage()); } catch (UnauthorizedException e) { throw new InvalidCredentialsOpenShiftException(url.toString(), e); } catch (NotFoundException e) { throw new NotFoundOpenShiftException(url.toString(), e); } catch (HttpClientException e) { throw new OpenShiftEndpointException( url.toString(), e, e.getMessage(), "Could not request {0}: {1}", url.toString(), getResponseMessage(e)); } catch (SocketTimeoutException e) { throw new OpenShiftTimeoutException(url.toString(), e, e.getMessage(), "Could not request url {0}, connection timed out", url.toString()); } }
@Override public void destroy(Container container) { assertValid(); IApplication app = getContainerApplication(container, false); if (app != null) { try { app.destroy(); } catch (NotFoundOpenShiftException e) { LOG.debug("Ignoring '{} when destroying {} container", e.getMessage(), container.getId()); } } }
@Override public RestResponse request(Link link, int timeout, IMediaType requestMediaType, IRestResponseFactory responseFactory, List<Parameter> urlPathParameter, List<Parameter> urlParameters, Parameter... parameters) throws OpenShiftException { // link.validateParameters(parameters); String url = link.getHref(server, SERVICE_PATH, urlPathParameter, urlParameters); try { String response = request(new URL(url), link.getHttpMethod(), requestMediaType, timeout, parameters); return responseFactory.get(response); } catch (EncodingException e) { throw new OpenShiftException(e, e.getMessage()); } catch (MalformedURLException e) { throw new OpenShiftException(e, e.getMessage()); } catch (UnauthorizedException e) { throw new InvalidCredentialsOpenShiftException(url, e, getRestResponse(e)); } catch (NotFoundException e) { throw new NotFoundOpenShiftException(url, e, getRestResponse(e)); } catch (HttpClientException e) { RestResponse restResponse = getRestResponse(e); String message = getMessage(restResponse, e); throw new OpenShiftEndpointException( url, e, restResponse, "Could not request {0}: {1}", url, message); } catch (SocketTimeoutException e) { throw new OpenShiftTimeoutException(url, e, "Could not request url {0}, connection timed out", url); } }