org.springframework.web.client.ResponseErrorHandler Java Examples

The following examples show how to use org.springframework.web.client.ResponseErrorHandler. 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   Author: WeBankPartners   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
Source Project: servicecomb-java-chassis   Author: apache   File: TestRestTemplateWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@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   Author: zalando-stups   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
Source Project: wecube-platform   Author: WeBankPartners   File: JwtSsoResponseErrorHandler.java    License: Apache License 2.0 4 votes vote down vote up
public JwtSsoResponseErrorHandler(ResponseErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
 
Example #5
Source Project: cf-java-client-sap   Author: SAP   File: CloudControllerRestClientImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    restTemplate.setErrorHandler(errorHandler);
}
 
Example #6
Source Project: cf-java-client-sap   Author: SAP   File: CloudControllerClientImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example #7
Source Project: servicecomb-java-chassis   Author: apache   File: RestTemplateWrapper.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setErrorHandler(ResponseErrorHandler errorHandler) {
  super.setErrorHandler(errorHandler);
  acceptableRestTemplates.forEach(template -> template.setErrorHandler(errorHandler));
  defaultRestTemplate.setErrorHandler(errorHandler);
}
 
Example #8
Source Project: multiapps-controller   Author: cloudfoundry-incubator   File: LoggingCloudControllerClient.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example #9
Source Project: multiapps-controller   Author: cloudfoundry-incubator   File: ResilientCloudControllerClient.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    executeWithRetry(() -> delegate.setResponseErrorHandler(errorHandler));
}
 
Example #10
Source Project: cloudstreetmarket.com   Author: alex-bretet   File: Yahoo2Template.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected ResponseErrorHandler errorHandler() {
    return new DefaultResponseErrorHandler();
}
 
Example #11
Source Project: booties   Author: zalando-stups   File: AbstractGithubTemplate.java    License: Apache License 2.0 4 votes vote down vote up
public RestOperations getRestOperations(ResponseErrorHandler responseErrorHandler) {
	return restOperations;
}
 
Example #12
Source Project: shimmer   Author: openmhealth   File: FitbitAuthorizationCodeAccessTokenProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected ResponseErrorHandler getResponseErrorHandler() {

    return super.getResponseErrorHandler();
}
 
Example #13
Source Project: spring-vault   Author: spring-projects   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   Author: spring-projects   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   Author: SAP   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
Source Project: cf-java-client-sap   Author: SAP   File: CloudControllerRestClient.java    License: Apache License 2.0 votes vote down vote up
void setResponseErrorHandler(ResponseErrorHandler errorHandler);