当前位置: 首页>>代码示例>>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;未经允许,请勿转载。