首页 > 技术文章 > 如何刷新或清除HttpURLConnection的连接缓存

shiningrise 2016-10-08 23:54 原文

项目需要定期与远程服务器同步数据,基于如下代码: 
URL url = new URL("http://test.com/sales/info"); 
connection = (HttpURLConnection) url.openConnection(); 
connection.setRequestMethod("POST"); 
connection.setDoOutput(true); 
connection.setUseCaches(false);

 

推荐阅读