org.springframework.web.client.RestTemplate.acceptHeaderRequestCallback()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中org.springframework.web.client.RestTemplate.acceptHeaderRequestCallback方法的一些代码示例,展示了RestTemplate.acceptHeaderRequestCallback的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestTemplate.acceptHeaderRequestCallback方法的具体详情如下:
包路径:org.springframework.web.client.RestTemplate
类名称:RestTemplate
方法名:acceptHeaderRequestCallback

RestTemplate.acceptHeaderRequestCallback介绍

[英]Return a RequestCallback that sets the request Acceptheader based on the given response type, cross-checked against the configured message converters.
[中]返回一个RequestCallback,它根据给定的响应类型设置request Acceptheader,并对照配置的消息转换器进行交叉检查。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Returns a request callback implementation that prepares the request {@code Accept}
 * headers based on the given response type and configured {@linkplain
 * #getMessageConverters() message converters}.
 */
protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType) {
  return new AsyncRequestCallbackAdapter(this.syncTemplate.acceptHeaderRequestCallback(responseType));
}

代码示例来源:origin: org.springframework/spring-web

/**
 * Returns a request callback implementation that prepares the request {@code Accept}
 * headers based on the given response type and configured {@linkplain
 * #getMessageConverters() message converters}.
 */
protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType) {
  return new AsyncRequestCallbackAdapter(this.syncTemplate.acceptHeaderRequestCallback(responseType));
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor));
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
    throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables));
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)
    throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables));
}

代码示例来源:origin: org.springframework/spring-web

@Override
@Nullable
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor);
}

代码示例来源:origin: org.springframework/spring-web

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: org.springframework/spring-web

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: org.springframework/spring-web

@Override
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)
    throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables));
}

代码示例来源:origin: org.springframework/spring-web

@Override
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor));
}

代码示例来源:origin: org.springframework/spring-web

@Override
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
    throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables));
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns a request callback implementation that prepares the request {@code Accept}
 * headers based on the given response type and configured {@linkplain
 * #getMessageConverters() message converters}.
 */
protected <T> AsyncRequestCallback acceptHeaderRequestCallback(Class<T> responseType) {
  return new AsyncRequestCallbackAdapter(this.syncTemplate.acceptHeaderRequestCallback(responseType));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
@Nullable
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  HttpMessageConverterExtractor<T> responseExtractor =
      new HttpMessageConverterExtractor<>(responseType, getMessageConverters(), logger);
  return execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
    throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor, uriVariables));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
  RequestCallback requestCallback = acceptHeaderRequestCallback(responseType);
  ResponseExtractor<ResponseEntity<T>> responseExtractor = responseEntityExtractor(responseType);
  return nonNull(execute(url, HttpMethod.GET, requestCallback, responseExtractor));
}

相关文章