Java 类org.springframework.web.client.ResponseErrorHandler 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilder.java   
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
        Set<HttpMessageConverter<?>> messageConverters,
        ClientHttpRequestFactory requestFactory,
        UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler,
        BasicAuthorizationInterceptor basicAuthorization,
        Set<RestTemplateCustomizer> restTemplateCustomizers,
        Set<RequestFactoryCustomizer> requestFactoryCustomizers) {
    super();
    this.detectRequestFactory = detectRequestFactory;
    this.rootUri = rootUri;
    this.messageConverters = messageConverters;
    this.requestFactory = requestFactory;
    this.uriTemplateHandler = uriTemplateHandler;
    this.errorHandler = errorHandler;
    this.basicAuthorization = basicAuthorization;
    this.restTemplateCustomizers = restTemplateCustomizers;
    this.requestFactoryCustomizers = requestFactoryCustomizers;
}
项目:spring-boot-concourse    文件:RestTemplateBuilder.java   
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
        Set<HttpMessageConverter<?>> messageConverters,
        ClientHttpRequestFactory requestFactory,
        UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler,
        BasicAuthorizationInterceptor basicAuthorization,
        Set<RestTemplateCustomizer> customizers) {
    super();
    this.detectRequestFactory = detectRequestFactory;
    this.rootUri = rootUri;
    this.messageConverters = messageConverters;
    this.requestFactory = requestFactory;
    this.uriTemplateHandler = uriTemplateHandler;
    this.errorHandler = errorHandler;
    this.basicAuthorization = basicAuthorization;
    this.customizers = customizers;
}
项目:oauth-client-master    文件:ClientCredentialsProviderTests.java   
@Test
@OAuth2ContextConfiguration(resource = InvalidClientCredentials.class, initialize = false)
public void testInvalidCredentials() throws Exception {
    context.setAccessTokenProvider(new ClientCredentialsAccessTokenProvider() {
        @Override
        protected ResponseErrorHandler getResponseErrorHandler() {
            return new DefaultResponseErrorHandler() {
                public void handleError(ClientHttpResponse response) throws IOException {
                    responseHeaders = response.getHeaders();
                    responseStatus = response.getStatusCode();
                }
            };
        }
    });
    try {
        context.getAccessToken();
        fail("Expected ResourceAccessException");
    }
    catch (Exception e) {
        // ignore
    }
    // System.err.println(responseHeaders);
    String header = responseHeaders.getFirst("WWW-Authenticate");
    assertTrue("Wrong header: " + header, header.contains("Basic realm"));
    assertEquals(HttpStatus.UNAUTHORIZED, responseStatus);
}
项目:itsme    文件:MyRestClient.java   
public void handleError() {
    // handle error2
    RestTemplate client = new RestTemplate();
    ResponseErrorHandler responseErrorHandler = new DefaultResponseErrorHandler() {
        @Override
        public void handleError(ClientHttpResponse response)
                throws IOException {
            LOGGER.warn("response status: '{}', headers: '{}'",
                    response.getStatusCode(), response.getHeaders());
        }
    };

    client.setErrorHandler(responseErrorHandler);

    client.exchange("http://localhost:8080/person/denied", HttpMethod.GET,
            null, String.class);
}
项目:incubator-servicecomb-java-chassis    文件:TestRestTemplateWrapper.java   
@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);
}
项目:fullstop    文件:ClientConfig.java   
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;
}
项目:oauth-client-master    文件:ClientCredentialsProviderTests.java   
@Test
@OAuth2ContextConfiguration(resource = InvalidClientCredentials.class, initialize = false)
public void testInvalidCredentialsWithFormAuthentication() throws Exception {
    resource.setClientAuthenticationScheme(AuthenticationScheme.form);
    context.setAccessTokenProvider(new ClientCredentialsAccessTokenProvider() {
        @Override
        protected ResponseErrorHandler getResponseErrorHandler() {
            return new DefaultResponseErrorHandler() {
                public void handleError(ClientHttpResponse response) throws IOException {
                    responseHeaders = response.getHeaders();
                    responseStatus = response.getStatusCode();
                }
            };
        }
    });
    try {
        context.getAccessToken();
        fail("Expected ResourceAccessException");
    }
    catch (Exception e) {
        // ignore
    }
    // System.err.println(responseHeaders);
    String header = responseHeaders.getFirst("WWW-Authenticate");
    assertTrue("Wrong header: " + header, header.contains("Form realm"));
    assertEquals(HttpStatus.UNAUTHORIZED, responseStatus);
}
项目:StockAnalyze    文件:GaeRestTemplate.java   
public GaeRestTemplate(Type responseType, ResponseErrorHandler errorHandler, List<ClientHttpRequestInterceptor> interceptors) {
    this.setErrorHandler(errorHandler);
    this.setInterceptors(interceptors);

    final GsonHttpMessageConverter converter = new GsonHttpMessageConverter();
    if (responseType != null) {
        converter.setType(responseType);
    }

    this.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(converter));
}
项目:incubator-servicecomb-java-chassis    文件:RestTemplateWrapper.java   
@Override
public void setErrorHandler(ResponseErrorHandler errorHandler) {
  super.setErrorHandler(errorHandler);
  acceptableRestTemplates.forEach(template -> template.setErrorHandler(errorHandler));
  defaultRestTemplate.setErrorHandler(errorHandler);
}
项目:cf-java-client-sap    文件:CloudControllerClientImpl.java   
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    this.restTemplate.setErrorHandler(errorHandler);
}
项目:cf-java-client-sap    文件:CloudFoundryClient.java   
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
    cc.setResponseErrorHandler(errorHandler);
}
项目:cf-mta-deploy-service    文件:MockCloudFoundryClient.java   
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {
}
项目:service-integration-sdk    文件:DefaultRestTemplateFactoryImpl.java   
public DefaultRestTemplateFactoryImpl(ResponseErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilderTests.java   
@Test
public void errorHandlerShouldApply() throws Exception {
    ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);
    RestTemplate template = this.builder.errorHandler(errorHandler).build();
    assertThat(template.getErrorHandler()).isSameAs(errorHandler);
}
项目:spring-boot-concourse    文件:RestTemplateBuilderTests.java   
@Test
public void errorHandlerShouldApply() throws Exception {
    ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);
    RestTemplate template = this.builder.errorHandler(errorHandler).build();
    assertThat(template.getErrorHandler()).isSameAs(errorHandler);
}
项目:cloudstreetmarket.com    文件:Yahoo2Template.java   
protected ResponseErrorHandler errorHandler() {
    return new DefaultResponseErrorHandler();
}
项目:booties    文件:AbstractGithubTemplate.java   
public RestOperations getRestOperations(ResponseErrorHandler responseErrorHandler) {
    return restOperations;
}
项目:shimmer    文件:FitbitAuthorizationCodeAccessTokenProvider.java   
@Override
protected ResponseErrorHandler getResponseErrorHandler() {

    return super.getResponseErrorHandler();
}
项目:oauth-client-master    文件:OAuth2AccessTokenSupport.java   
protected ResponseErrorHandler getResponseErrorHandler() {
    return responseErrorHandler;
}
项目:bitcoind-client    文件:BitcoindClientDefaultConfig.java   
private ResponseErrorHandler errorHandler() {
    return new BitcoindJsonRpcErrorHandler();
}
项目:StockAnalyze    文件:MyClientHttpRequestInterceptor.java   
MyClientHttpRequestInterceptor(Context context, ResponseErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
    this.pref = context.getSharedPreferences(Utils.PREF_NAME, 0);
    this.cookie = this.pref.getString(Utils.PREF_COOKIE, null);
}
项目:cf-java-client-sap    文件:CloudFoundryOperations.java   
/**
 * Override the default REST response error handler with a custom error handler.
 *
 * @param errorHandler
 */
void setResponseErrorHandler(ResponseErrorHandler errorHandler);
项目:db-dumper-service    文件:CloudFoundryClientFake.java   
@Override
public void setResponseErrorHandler(ResponseErrorHandler errorHandler) {

}
项目:oauth-client-master    文件:OAuth2ErrorHandler.java   
/**
 * Construct an error handler that can deal with OAuth2 concerns before delegating to acustom handler.
 * 
 * @param errorHandler a delegate handler
 */
public OAuth2ErrorHandler(ResponseErrorHandler errorHandler, OAuth2ProtectedResourceDetails resource) {
    this.resource = resource;
    this.errorHandler = errorHandler;
}
项目:cf-java-client-sap    文件:CloudControllerClient.java   
void setResponseErrorHandler(ResponseErrorHandler errorHandler);