Java Code Examples for org.springframework.web.client.ResponseErrorHandler

The following examples show how to use org.springframework.web.client.ResponseErrorHandler. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: wecube-platform   Source File: JwtSsoRestTemplate.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setErrorHandler(ResponseErrorHandler errorHandler) {
    if (!(errorHandler instanceof JwtSsoResponseErrorHandler)) {
        errorHandler = new JwtSsoResponseErrorHandler(errorHandler);
    }

    super.setErrorHandler(errorHandler);
}
 
Example 2
@Test
public void setErrorHandlerWithUnderlying() {
  ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);

  wrapper.setErrorHandler(errorHandler);

  assertThat(wrapper.getErrorHandler(), is(errorHandler));
  assertThat(wrapper.defaultRestTemplate.getErrorHandler(), is(errorHandler));

  verify(underlying).setErrorHandler(errorHandler);
}
 
Example 3
Source Project: fullstop   Source File: ClientConfig.java    License: Apache License 2.0 5 votes vote down vote up
private RestOperations buildOAuth2RestTemplate(final String tokenName, final ResponseErrorHandler errorHandler) {
    final RestTemplate restTemplate = new StupsOAuth2RestTemplate(
            new StupsTokensAccessTokenProvider(tokenName, accessTokens),
            new HttpComponentsClientHttpRequestFactory());

    if (errorHandler != null) {
        restTemplate.setErrorHandler(errorHandler);
    }

    return restTemplate;
}
 
Example 4
public JwtSsoResponseErrorHandler(ResponseErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
 
Example 5
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    restTemplate.setErrorHandler(errorHandler);
}
 
Example 6
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example 7
@Override
public void setErrorHandler(ResponseErrorHandler errorHandler) {
  super.setErrorHandler(errorHandler);
  acceptableRestTemplates.forEach(template -> template.setErrorHandler(errorHandler));
  defaultRestTemplate.setErrorHandler(errorHandler);
}
 
Example 8
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example 9
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    executeWithRetry(() -> delegate.setResponseErrorHandler(errorHandler));
}
 
Example 10
protected ResponseErrorHandler errorHandler() {
    return new DefaultResponseErrorHandler();
}
 
Example 11
Source Project: booties   Source File: AbstractGithubTemplate.java    License: Apache License 2.0 4 votes vote down vote up
public RestOperations getRestOperations(ResponseErrorHandler responseErrorHandler) {
	return restOperations;
}
 
Example 12
@Override
protected ResponseErrorHandler getResponseErrorHandler() {

    return super.getResponseErrorHandler();
}
 
Example 13
Source Project: spring-vault   Source File: RestTemplateBuilderUnitTests.java    License: Apache License 2.0 3 votes vote down vote up
@Test
void shouldApplyErrorHandler() {

	ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();

	RestTemplate restTemplate = RestTemplateBuilder.builder().endpoint(VaultEndpoint.create("localhost", 8200))
			.errorHandler(errorHandler).build();

	assertThat(restTemplate.getErrorHandler()).isSameAs(errorHandler);
}
 
Example 14
Source Project: spring-vault   Source File: RestTemplateBuilderUnitTests.java    License: Apache License 2.0 3 votes vote down vote up
@Test
void shouldApplyErrorHandlerViaCustomizer() {

	ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();

	RestTemplate restTemplate = RestTemplateBuilder.builder().endpoint(VaultEndpoint.create("localhost", 8200))
			.customizers(it -> it.setErrorHandler(errorHandler)).build();

	assertThat(restTemplate.getErrorHandler()).isSameAs(errorHandler);
}
 
Example 15
Source Project: cf-java-client-sap   Source File: CloudControllerClient.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Override the default REST response error handler with a custom error handler.
 *
 * @param errorHandler
 */
void setResponseErrorHandler(ResponseErrorHandler errorHandler);
 
Example 16
void setResponseErrorHandler(ResponseErrorHandler errorHandler);