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 File: JwtSsoRestTemplate.java    From wecube-platform with 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 File: TestRestTemplateWrapper.java    From servicecomb-java-chassis with 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 File: ClientConfig.java    From fullstop with 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 File: JwtSsoResponseErrorHandler.java    From wecube-platform with Apache License 2.0 4 votes vote down vote up
public JwtSsoResponseErrorHandler(ResponseErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
 
Example #5
Source File: CloudControllerRestClientImpl.java    From cf-java-client-sap with Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    restTemplate.setErrorHandler(errorHandler);
}
 
Example #6
Source File: CloudControllerClientImpl.java    From cf-java-client-sap with Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example #7
Source File: RestTemplateWrapper.java    From servicecomb-java-chassis with 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 File: LoggingCloudControllerClient.java    From multiapps-controller with Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    delegate.setResponseErrorHandler(errorHandler);
}
 
Example #9
Source File: ResilientCloudControllerClient.java    From multiapps-controller with Apache License 2.0 4 votes vote down vote up
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    executeWithRetry(() -> delegate.setResponseErrorHandler(errorHandler));
}
 
Example #10
Source File: Yahoo2Template.java    From cloudstreetmarket.com with GNU General Public License v3.0 4 votes vote down vote up
protected ResponseErrorHandler errorHandler() {
    return new DefaultResponseErrorHandler();
}
 
Example #11
Source File: AbstractGithubTemplate.java    From booties with Apache License 2.0 4 votes vote down vote up
public RestOperations getRestOperations(ResponseErrorHandler responseErrorHandler) {
	return restOperations;
}
 
Example #12
Source File: FitbitAuthorizationCodeAccessTokenProvider.java    From shimmer with Apache License 2.0 4 votes vote down vote up
@Override
protected ResponseErrorHandler getResponseErrorHandler() {

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