Example usage for org.springframework.web.client RestTemplate setErrorHandler

List of usage examples for org.springframework.web.client RestTemplate setErrorHandler

Introduction

In this page you can find the example usage for org.springframework.web.client RestTemplate setErrorHandler.

Prototype

public void setErrorHandler(ResponseErrorHandler errorHandler) 

Source Link

Document

Set the error handler.

Usage

From source file:org.springframework.social.mixcloud.api.impl.MixcloudTemplate.java

@Override
protected void configureRestTemplate(RestTemplate restTemplate) {
    restTemplate.setErrorHandler(new MixcloudErrorHandler());
}

From source file:org.intermine.app.net.request.BaseRequest.java

@Override
public RestTemplate getRestTemplate() {
    HttpClient httpClient = HttpUtils.getNewHttpClient();

    RestTemplate rtp = super.getRestTemplate();
    rtp.setErrorHandler(new ServerErrorHandler());
    rtp.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient));

    return rtp;/*  w  w  w  .j  av  a  2s  .  c o m*/
}

From source file:com.gopivotal.cloudfoundry.test.support.TestConfiguration.java

@Bean
RestOperations restOperations() {/*from   w  ww. j  a  va 2s.c o m*/
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setErrorHandler(new NoErrorResponseErrorHandler());

    return restTemplate;
}

From source file:co.mafiagame.telegraminterface.inputhandler.UpdateController.java

private void setErrorHandler(RestTemplate restTemplate) {
    restTemplate.setErrorHandler(new ResponseErrorHandler() {
        @Override//from  www .  java  2  s .  c  o m
        public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException {
            return !clientHttpResponse.getStatusCode().equals(HttpStatus.OK);
        }

        @Override
        public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
            logger.error("error calling telegram getUpdate\n code:{}\n{}", clientHttpResponse.getStatusCode(),
                    IOUtils.toString(clientHttpResponse.getBody()));
        }
    });
}

From source file:com.feedeo.shopify.web.resource.rest.ShopifyOAuth2RestResource.java

public ShopifyOAuth2RestResource() {
    RestTemplate restTemplate = (RestTemplate) client.getRestOperations();
    restTemplate.setErrorHandler(new ShopifyOAuth2RestResourceErrorHandler());
}

From source file:com.epam.ta.reportportal.core.configs.ExternalSystemsConfiguration.java

@Bean
public RestTemplate restTemplate() {
    RestTemplate restTemplate = new RestTemplate(
            Collections.singletonList(new MappingJackson2HttpMessageConverter()));
    restTemplate.setErrorHandler(new ForwardingClientExceptionHandler());
    return restTemplate;
}

From source file:org.springframework.social.exfm.api.impl.ExFmTemplate.java

@Override
protected void configureRestTemplate(RestTemplate restTemplate) {
    restTemplate.setErrorHandler(new ExFmErrorHandler());
}

From source file:org.springframework.social.soundcloud.api.impl.SoundCloudTemplate.java

@Override
protected void configureRestTemplate(RestTemplate restTemplate) {
    restTemplate.setErrorHandler(new SoundCloudErrorHandler());
}

From source file:dk.clanie.bitcoin.client.BitcoindClientDefaultConfig.java

@Bean
public RestTemplate restTemplate() {
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setRequestFactory(requestFactory());
    restTemplate.setErrorHandler(errorHandler());
    return restTemplate;
}

From source file:nu.yona.server.CoreConfiguration.java

@Bean
public RestTemplate restTemplate(ObjectMapper objectMapper) {
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setErrorHandler(new RestClientErrorHandler(objectMapper));
    return restTemplate;
}