Examples of RestClientException


Examples of io.fathom.cloud.openstack.client.RestClientException

            InputStream is;
            try {
                is = response.getInputStream();
            } catch (IOException e) {
                throw new RestClientException("Error reading response", e);
            }
            if (is == null) {
                throw new IllegalStateException();
            }
View Full Code Here

Examples of io.fathom.cloud.openstack.client.RestClientException

            }
        } catch (RestClientException e) {
            if (ret.isEmpty() && e.is(404)) {
                return null;
            }
            throw new RestClientException("Error listing children", e);
        }
        return ret;
    }
View Full Code Here

Examples of io.fathom.cloud.openstack.client.RestClientException

        V2AuthRequest.ChallengeResponse challengeResponse = ChallengeResponses.respondToRegistrationChallenge(
                certificateAndKey, registerResponse.challenge);
        registerRequest.challengeResponse = challengeResponse;
        registerResponse = client.register(registerRequest, certificateAndKey);
        if (Strings.isNullOrEmpty(registerResponse.userId)) {
            throw new RestClientException("Unable to register (invalid response)");
        }
    }
View Full Code Here

Examples of io.fathom.cloud.openstack.client.RestClientException

            return true;
        } catch (RestClientException e) {
            if (e.is(404)) {
                return false;
            }
            throw new RestClientException("Error deleting cloud file", e);
        }
    }
View Full Code Here

Examples of io.fathom.cloud.openstack.client.RestClientException

        request.setHeader("X-Auth-Token", token);
        try {
            request.setRequestContent(ByteSource.wrap(data));
        } catch (IOException e) {
            throw new RestClientException("Error setting request content", e);
        }

        doStringRequest(request);
    }
View Full Code Here

Examples of org.platformlayer.rest.RestClientException

      StatusLine statusLine = response.getStatusLine();
      if (statusLine.getStatusCode() != 200) {
        log.info("Error reading from metrics service: " + statusLine);

        throw new RestClientException("Error reading from metrics service", null, statusLine.getStatusCode());
      } else {
        MetricServiceData ret = new MetricServiceData(request, response);

        response = null; // Don't close yet

        return ret;
      }
    } catch (IOException e) {
      throw new RestClientException("Error reading from metrics service", e);
    } finally {
      if (response != null) {
        try {
          EntityUtils.consume(response.getEntity());
        } catch (IOException e) {
View Full Code Here

Examples of org.springframework.web.client.RestClientException

        //for the third -- in this case the two items should have the new content but the third with the exception should
        //retain the old good cached content.
        String newContent = "new content from refresh";
        restTemplate = createNiceMock(RestTemplate.class);
        expect(restTemplate.getForObject(new URI(VALID_URL1), String.class)).andReturn(newContent);
        expect(restTemplate.getForObject(new URI(VALID_URL2), String.class)).andThrow(new RestClientException("Boom"));
        expect(restTemplate.getForObject(new URI(VALID_URL3), String.class)).andReturn(newContent);
        replay(restTemplate);
        //Use reflection to stuff the new RestTemplate instance into our existing content fetcher instance
        ReflectionTestUtils.setField(service, "restTemplate", restTemplate);
View Full Code Here

Examples of org.springframework.web.client.RestClientException

                        + requestType.getName() + "]";
                if (requestContentType != null) {
                    message += " and content type [" + requestContentType + "]";
                }

                throw new RestClientException(message);
            }
        }
View Full Code Here

Examples of org.springframework.web.client.RestClientException

        //for the third -- in this case the two items should have the new content but the third with the exception should
        //retain the old good cached content.
        String newContent = "new content from refresh";
        restTemplate = createNiceMock(RestTemplate.class);
        expect(restTemplate.getForObject(new URI(VALID_URL1), String.class)).andReturn(newContent);
        expect(restTemplate.getForObject(new URI(VALID_URL2), String.class)).andThrow(new RestClientException("Boom"));
        expect(restTemplate.getForObject(new URI(VALID_URL3), String.class)).andReturn(newContent);
        replay(restTemplate);
        //Use reflection to stuff the new RestTemplate instance into our existing content fetcher instance
        ReflectionTestUtils.setField(service, "restTemplate", restTemplate);
View Full Code Here

Examples of org.springframework.web.client.RestClientException

        public URI postForLocation(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
            setState(HttpMethod.POST, url);
            try {
                return new URI(url);
            } catch (URISyntaxException e) {
                throw new RestClientException("Failed to convert " + url + ": " + e.getMessage(), e);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.