Android HttpClient POST JSON Restful-web-services
@Override
protected String doInBackground(String... arg0) {
Gson gson = new Gson();
String json = gson.toJson(map); HttpPost httpPost = new HttpPost(WR.URL_YJFK); String result = null; try {
StringEntity entity = new StringEntity(json, HTTP.UTF_8); entity.setContentType("application/json");
httpPost.setEntity(entity);
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(httpPost); if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){
InputStream in = response.getEntity().getContent();
result = StrUtil.readString(in);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} return result;
}
Android HttpClient POST JSON Restful-web-services的更多相关文章
- jboss7 Java API for RESTful Web Services (JAX-RS) 官方文档
原文:https://docs.jboss.org/author/display/AS7/Java+API+for+RESTful+Web+Services+(JAX-RS) Content Tuto ...
- cxf开发Restful Web Services
一.restful web services rest全称是Representation State Transfer(表述性状态转移).它是一种软件架构风格,只是提供了一组设计原则和约束条件.在re ...
- .NET RESTful Web Services入门
很早之前看到过RESTful Web Services,并未在意,也没找相关资料进行学习.今天偶尔有一机会,就找了点资料进行研究,发现RESTful真是“简约而不简单”.下面用示例来说明: 1 项目结 ...
- RESTful Web Services初探
RESTful Web Services初探 作者:杜刚 近几年,RESTful Web Services渐渐开始流行,大量用于解决异构系统间的通信问题.很多网站和应用提供的API,都是基于RESTf ...
- Jersey the RESTful Web Services in Java
Jersey 是一个JAX-RS的实现, JAX-RS即Java API for RESTful Web Services, 支持按照表述性状态转移(REST)架构风格创建Web服务. REST 中最 ...
- 就是这么简单!使用Rest-assured 测试Restful Web Services
使用 Rest-assured 测试 Restful Web Services 转载注明出处: http://www.cnblogs.com/wade-xu/p/4298819.html 这里向大家介 ...
- RESTful Web Services测试工具推荐
命令行控的最爱:cURL cURL是一个很强大的支持各种协议的文件传输工具,用它来进行RESTful Web Services的测试简直是小菜一碟.这个工具基本上类Unix操作系统(各种Linux.M ...
- 【转】RESTful Web Services初探
近几年,RESTful Web Services渐渐开始流行,大量用于解决异构系统间的通信问题.很多网站和应用提供的API,都是基于RESTful风格的Web Services,比较著名的包括Twit ...
- RESTful Web Services简单介绍
近几年,RESTful Web Services渐渐开始流行,大量用于解决异构系统间的通信问题.很多网站和应用提供的API,都是基于RESTful风格的Web Services,比较著名的包括Twit ...
- RESTful Web Services: A Tutorial--reference
As REST has become the default for most Web and mobile apps, it's imperative to have the basics at y ...
随机推荐
- angularJs $injector
一 angularJS中几种注入方式 Spring中使用构造注入或者设值注入的方式,还需要做一些额外的操作,但是angular中只需要在需要的地方声明一下即可,类似模块的引用,因此十分方便. angu ...
- Java Web应用的开发模式
一.概述 从互联网诞生的第一天起,web从一个简单的静态页面,发展到今天五花八门.令人眼花缭乱的复杂应用,大到企业级的web应用系统,小到简单的SPA管理系统.在硬件性能提升的同时,通过各种技术实现了 ...
- CentOS 搭建 FastDFS-5.0.5集群
转http://www.open-open.com/lib/view/open1435468300700.html 第一步,确定目标: Tracker 192.168.224.20:22122 C ...
- SpringBoot 配置文件 application.properties(二)
mvc spring.mvc.async.request-timeout设定async请求的超时时间,以毫秒为单位,如果没有设置的话,以具体实现的超时时间为准,比如tomcat的servlet3的话是 ...
- C# 读取XML文件示例
有关XML文件编写规范,请参考:http://www.w3school.com.cn/xml/index.aspXML内容如下(文件名为:Information.xml):浏览器显示: <?xm ...
- Android开发艺术探索》读书笔记 (12) 第12章 Bitmap的加载和Cache
第12章 Bitmap的加载和Cache 12.1 Bitmap的高速加载 (1)Bitmap是如何加载的?BitmapFactory类提供了四类方法:decodeFile.decodeResourc ...
- Apache MINA 框架之Handler介绍
IoHandler 具备以下几个功能: sessionCreated sessionOpened sessionClosed sessionIdle exceptionCaught messageRe ...
- ORACLE 数据库总结
1.表和数据恢复 1.从回收站里查询被删除的表 select object_name,original_name,partition_name,type,ts_name,createtime,drop ...
- CSS从大图中抠取小图完整教程(background-position应用) (转)
自认为把background-position的应用讲得非常通俗易懂的教材.做个记号. 相信很多喜欢研究网页界面的童鞋都遇到过一个奇妙的现象:网页中很多图片素材被合成在一张图片上. 起初小菜模仿网站的 ...
- 获取Html中所有img的src
/// <summary> /// 获取所有Img中的Src /// </summary> /// <param name="htmlText"> ...