android 用json格式post数据
来源:互联网 发布:移动宽带没有网络 编辑:程序博客网 时间:2024/05/21 11:12
首先将待输出的数据存储在JSON对象中,然后编码输出,本来是想用HTTPUrlConnection方式post请求的,不知为何一直发不出去...求解,另外delete请求Log显示DELETE donot supper writing 不支持写,有人知道的帮个忙解决下,多谢啊!
public String postName(String baseUrl, String name) {
String result = "";HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(baseUrl);
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("name", name);
StringEntity entity = new StringEntity(jsonObject.toString(),"UTF-8");//解码中文
entity.setContentType("text/json");
entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
"application/json"));
post.setEntity(entity);
HttpResponse responString = client.execute(post);
result = convertStreamToString(responString.getEntity()
.getContent());
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
- android 用json格式post数据
- mui post json 格式数据
- Android读取JSON格式数据
- Android创建JSON格式数据
- Android 解析JSON格式数据
- Android--解析JSON格式数据
- android Json数据分装Post请求
- Android Post Json数据乱码问题
- extjs Post方法提交json格式的数据到php
- 如何POST一个JSON格式的数据给Restful服务
- 使用jquery和html5 post json格式数据
- 客户端POST提交、服务器返回json格式数据的demo
- Java 模拟post请求,发送json格式数据
- 如何POST一个JSON格式的数据给Restful服务
- 如何POST一个JSON格式的数据给Restful服务
- AFNetworkin POST Json格式的数据到服务器
- extjs Post方法提交json格式的数据到php
- 如何POST一个JSON格式的数据给Restful服务
- 超级坑人的Couchbase数据库问题!!!
- Delphi XE(Indy10)TIdBytes转AnsiString的实现
- IE8 Automation 服务器不能创建对象 解决方法
- python 内存泄漏及gc模块的使用
- 《openssl 编程》之 RSA
- android 用json格式post数据
- read_proc的用法实例
- 看看 Delphi XE2 为 VCL 提供的 14 种样式
- OpenRisc-35-基于orpsoc,eCos的sd card controller的测试实验
- OpenSSL应用之公钥算法RSA
- windows下mysql root密码丢失怎么办?如何修改root密码
- Flatten Binary Tree to Linked List
- Surfaceflinger 一点解释
- 重载和重写的区别