當前位置: 首頁>>代碼示例>>Java>>正文


Java RestTemplate.getRequestFactory方法代碼示例

本文整理匯總了Java中org.springframework.web.client.RestTemplate.getRequestFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java RestTemplate.getRequestFactory方法的具體用法?Java RestTemplate.getRequestFactory怎麽用?Java RestTemplate.getRequestFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.client.RestTemplate的用法示例。


在下文中一共展示了RestTemplate.getRequestFactory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: connect

import org.springframework.web.client.RestTemplate; //導入方法依賴的package包/類
private T connect(final PathBuilder config) throws RestClientException {
	final RestTemplate restTemplate = new RestTemplate(httpMessageConverters);
	final SimpleClientHttpRequestFactory rf = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();
	rf.setReadTimeout(2000);
	rf.setConnectTimeout(2000);
	config.addParam("t", RestfulContext.getToken());
	final ResponseEntity<T> re = restTemplate.getForEntity(config.buildEndpointURI(), dtoType);
	return re.getBody();
}
 
開發者ID:ad-tech-group,項目名稱:openssp,代碼行數:10,代碼來源:JsonDataProviderConnector.java

示例2: loginDataProvider

import org.springframework.web.client.RestTemplate; //導入方法依賴的package包/類
/**
 * Creates a login call to remote webservice.
 * 
 * @param config
 * @return token | RestClientException
 */
public static String loginDataProvider(final PathBuilder config) {
	final MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
	map.add("u", config.getMaster_user());
	map.add("p", config.getMaster_pw());
	final RestTemplate restTemplate = new RestTemplate();
	final SimpleClientHttpRequestFactory rf = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();
	rf.setReadTimeout(3000);
	rf.setConnectTimeout(30000);
	try {
		final URI uri = new URIBuilder().setScheme("http").setCharset(StandardCharsets.UTF_8).setHost(config
				.getServer()).setPath("/ssp-data-provider/login/token").build();
		final TokenWrapper result = restTemplate.postForObject(uri, map, TokenWrapper.class);
		return result.getToken();
	} catch (final URISyntaxException | RestClientException e) {
		System.out.println("[WARNING] LoginService: " + e.getMessage());
	}

	return null;
}
 
開發者ID:ad-tech-group,項目名稱:openssp,代碼行數:26,代碼來源:LoginService.java

示例3: TuPactRecordingServer

import org.springframework.web.client.RestTemplate; //導入方法依賴的package包/類
protected TuPactRecordingServer(RestTemplate restTemplate, File pactFile, ObjectStringConverter objectConverter, MediaType contentType) {
    this.restTemplate = restTemplate;
    this.pactFile = pactFile;
    this.objectConverter = objectConverter;
    originalRequestFactory = restTemplate.getRequestFactory();
    mockRestServiceServer = MockRestServiceServer.createServer(restTemplate);
    this.contentType = contentType;
}
 
開發者ID:tyro,項目名稱:pact-spring-mvc,代碼行數:9,代碼來源:TuPactRecordingServer.java

示例4: init

import org.springframework.web.client.RestTemplate; //導入方法依賴的package包/類
@PostConstruct
public void init() {
  restTemplate = new RestTemplate();

  SimpleClientHttpRequestFactory rf = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();
  rf.setReadTimeout(portalConfig.readTimeout());
  rf.setConnectTimeout(portalConfig.connectTimeout());

  MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
  converter.setSupportedMediaTypes(
      Arrays.asList(MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM));

  restTemplate.setMessageConverters(Arrays.asList(converter, new FormHttpMessageConverter()));

}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:16,代碼來源:CtripMQService.java

示例5: configureCloudFoundryRequestFactory

import org.springframework.web.client.RestTemplate; //導入方法依賴的package包/類
protected void configureCloudFoundryRequestFactory(RestTemplate restTemplate) {
    ClientHttpRequestFactory requestFactory = restTemplate.getRequestFactory();
    if (!(requestFactory instanceof CloudFoundryClientHttpRequestFactory)) {
        restTemplate.setRequestFactory(new CloudFoundryClientHttpRequestFactory(requestFactory));
    }
}
 
開發者ID:SAP,項目名稱:cf-java-client-sap,代碼行數:7,代碼來源:CloudControllerClientImpl.java


注:本文中的org.springframework.web.client.RestTemplate.getRequestFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。