public static String post(String url, String data) throws ClientProtocolException, IOException {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
//设置请求和传输超时时间
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();
httpPost.setConfig(requestConfig);
httpPost.setHeader("Content-Type","application/json; charset=utf-8");
httpPost.setEntity(new StringEntity(data.toString(), Charset.forName("UTF-8")));
HttpResponse response = httpClient.execute(httpPost);
String httpEntityContent = getHttpEntityContent(response);
httpPost.abort();
return httpEntityContent;
}

最新文章

  1. MySql 绿色版配置
  2. JSP基础语法
  3. Java实现注册时发送激活邮件+激活
  4. The quieter you become,The more you are able to hear.
  5. .NET技术在中国为什么老被人嫌弃
  6. git branch用法总结
  7. ABBYY PDF Transformer+ Pro支持全世界189种语言
  8. jquery 常用组件的小代码
  9. sencha touch xtype
  10. HTML特殊字符编码大全
  11. 三、FreeMarker 模版开发指南 第三章 模版
  12. Python读入与写出中文时出现乱码
  13. (转)C++中extern “C”含义深层探索
  14. Codecademy学习打卡1
  15. Python 2.7 学习笔记 内置语句、函数、标准库
  16. Wind River Linux 6 Security Profile
  17. OpenGL红宝书例子2.2 uniform变量的使用
  18. Fliptile 翻格子游戏[Usaco2007 Open]
  19. Linux - 简明Shell编程12 - 定制输出(ColorOutput)
  20. Oracle实战笔记(第七天)之PL/SQL进阶

热门文章

  1. 深度学习方法(十一):卷积神经网络结构变化——Google Inception V1-V4,Xception(depthwise convolution)
  2. (转)OpenCV 访问Mat中每个像素的值
  3. android4.0 锁屏实现(转)
  4. fastdfs5.11+centos7.2 按照部署(三)【转载】
  5. day2 购物商城
  6. iis应用池内存溢出卡死优化
  7. Three.js基础探寻七——Lamber材质与Phong材质
  8. Eclipse中Tomcat 修改后台代码即时生效
  9. 关于 bitset 的一些题目
  10. 洛谷——P1330 封锁阳光大学