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.eclipse.cft.server.core.internal.client.RestUtils.java

public static RestTemplate createRestTemplate(HttpProxyConfiguration httpProxyConfiguration,
        boolean trustSelfSignedCerts, boolean disableRedirectHandling) {
    RestTemplate restTemplate = new LoggingRestTemplate();
    restTemplate.setRequestFactory(// www  .  j  a v a 2s.c  om
            createRequestFactory(httpProxyConfiguration, trustSelfSignedCerts, disableRedirectHandling));
    restTemplate.setErrorHandler(new CloudControllerResponseErrorHandler());
    return restTemplate;
}

From source file:com.gooddata.GoodData.java

static RestTemplate createRestTemplate(GoodDataEndpoint endpoint, HttpClient httpClient) {
    notNull(endpoint, "endpoint");
    notNull(httpClient, "httpClient");

    final UriPrefixingClientHttpRequestFactory factory = new UriPrefixingClientHttpRequestFactory(
            new HttpComponentsClientHttpRequestFactory(httpClient), endpoint.toUri());
    final RestTemplate restTemplate = new RestTemplate(factory);
    restTemplate.setInterceptors(/*from www.  j  a  va 2  s.c  o m*/
            Arrays.asList(new HeaderSettingRequestInterceptor(singletonMap("Accept", getAcceptHeaderValue()))));

    restTemplate.setErrorHandler(new ResponseErrorHandler(restTemplate.getMessageConverters()));

    return restTemplate;
}

From source file:com.github.gabrielruiu.springsocial.yahoo.api.impl.YahooTemplate.java

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

From source file:org.kurento.repository.test.util.ContextByTestSpringBootTest.java

protected RestTemplate getRestTemplate() {
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
        @Override//from  w  ww  . jav  a  2 s. c  om
        public void handleError(ClientHttpResponse response) throws IOException {
            log.error(response.getStatusText());
        }
    });
    return restTemplate;
}

From source file:org.zalando.riptide.RedirectTest.java

public RedirectTest() {
    final RestTemplate template = new RestTemplate();
    template.setErrorHandler(new PassThroughResponseErrorHandler());
    this.server = MockRestServiceServer.createServer(template);
    this.unit = Rest.create(template);
}

From source file:org.springframework.social.box.api.impl.BoxTemplate.java

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

From source file:org.springframework.social.wunderlist.api.impl.WunderlistTemplate.java

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

From source file:org.springframework.social.wechat.api.impl.WechatTemplate.java

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

From source file:com.github.cric.common.service.cripapi.CricApiConfiguration.java

@Bean
public RestTemplate cricApiRestTemplate() {

    RestTemplate template = new RestTemplate();
    template.setErrorHandler(new CustomResponseErrorHandler());
    template.getInterceptors().add(outgoingCricApiRequestLoggerInterceptor());
    template.getInterceptors().add(outgoingCricApiRequestInterceptor());
    return template;
}

From source file:org.springframework.social.cloudplaylists.api.impl.CloudPlaylistsTemplate.java

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