本文主要是介绍restemplate设置connection timeout,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
参考:http://stackoverflow.com/questions/11537591/resttemplate-default-timeout-value
@Override@SuppressWarnings("unchecked")protected Void doInBackground(Void... params) {// TODO Auto-generated method stubtry {final String url = getApplicationContext().getApiUrlBase()+ "android/register";Log.d(TAG, url);HttpHeaders requestHeaders = new HttpHeaders();requestHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(formData, requestHeaders);RestTemplate restTemplate = new RestTemplate(true);if (restTemplate.getRequestFactory() instanceof SimpleClientHttpRequestFactory) {((SimpleClientHttpRequestFactory) restTemplate.getRequestFactory()).setConnectTimeout(10 * 1000);((SimpleC
这篇关于restemplate设置connection timeout的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!