Google Volley: How to send a POST request with Json data?
sonObjectRequest actuallyaccepts JSONObject as body.
From http://arnab.ch/blog/2013/08/asynchronous-http-requests-in-android-using-volley/
final String url = "some/url";
final JSONObject jsonBody = /* ... */;
new JsonObjectRequest(url, jsonBody, new Response.Listener<JSONObject>() { ... });
Here is the offical code and javadoc (@param jsonRequest):
/**
* Creates a new request.
* @param method the HTTP method to use
* @param url URL to fetch the JSON from
* @param jsonRequest A {@link JSONObject} to post with the request. Null is allowed and
* indicates no parameters will be posted along with request.
* @param listener Listener to receive the JSON response
* @param errorListener Error listener, or null to ignore errors.
*/
public JsonObjectRequest(int method, String url, JSONObject jsonRequest,
Listener<JSONObject> listener, ErrorListener errorListener) {
super(method, url, (jsonRequest == null) ? null : jsonRequest.toString(), listener,
errorListener);
}
Google Volley: How to send a POST request with Json data?的更多相关文章
- Google Volley框架源码走读
PS一句:最终还是选择CSDN来整理发表这几年的知识点,该文章平行迁移到CSDN.因为CSDN也支持MarkDown语法了,牛逼啊! [工匠若水 http://blog.csdn.net/yanb ...
- [Project] Simulate HTTP Post Request to obtain data from Web Page by using Python Scrapy Framework
1. Background Though it's always difficult to give child a perfect name, parent never give up trying ...
- 客户端通过Feign发起请求 服务端通过request取 json对象
@RestController @RequestMapping(value = "test") public class TestServer { @RequestMapping( ...
- JMeter Ant Task 生成的*.jtl打开之后request和response data是空的,怎样让其不是空的呢?
JMeter Ant Task 生成的*.jtl打开之后request和response data是空的,怎样让其不是空的呢?修改JMeter.properties,将jmeter.save.save ...
- 获取 request 中 json 数据
import java.io.IOException; import javax.servlet.http.HttpServletRequest; /** * request 对象的相关操作 * @a ...
- flask request 获取json内容2种方式
# -*- coding: utf-8 -*-from flask import request, jsonify, json, Moduleimport loggingfrom web.utils. ...
- How Google Backs Up The Internet Along With Exabytes Of Other Data
出处:http://highscalability.com/blog/2014/2/3/how-google-backs-up-the-internet-along-with-exabytes-of- ...
- The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector.
springboot 表单体积过大时报错: The multi-part request contained parameter data (excluding uploaded files) tha ...
- 如何使用python内置的request发送JSON格式的数据
使用步骤如下: 一.如果想发送json格式的数据,需要使用request模块中的Request类来创建对象,作为urlopen函数的参数 二.header中添加content-type为applica ...
随机推荐
- 网络流量监控shell脚本
网络收发包计数记录在 /proc/net/dev 文件中, 要取得流量, 只需要读取里面的内容两次, 然后相减, 再除以时间间隔即可. #!/bin/bash #Usage1,record in fi ...
- Jquery获取selelct选中值
误区: 一直以为jquery获取select中option被选中的文本值,是这样写的: $("#s").text(); //获取所有option的文本值 实际上应该这样: $(& ...
- ADO.NET中的DataSet和DataAdapter
DataSet和DataTable DataSet是一个数据集合,存储在内存中,算是一个临时的数据库. 个人觉得,不是太常用了,DataTable或者直接用List<model>存数据比这 ...
- C puzzles详解【51-57题】
第五十一题 Write a C function which does the addition of two integers without using the '+' operator. You ...
- MyEclipse 选中属性或方法后 相同的不变色了?
MyEclipse 选中属性或方法后 相同的不变色了? myeclipse-->windows-->java-->Editor-->Mark Occurrences 把所有的框 ...
- nodejs服务器anywhere简介
一句话:随时随地将你的当前目录变成一个静态文件服务器的根目录. 安装 npm install anywhere -g 执行 $ anywhere // or with port $ anywhere ...
- 学习c的第7天
#include <stdio.h> int main() { int x=0; if (x==0) { printf("x为假\n"); } else { print ...
- php 显示内存 释放内存
<?php //这只是个例子,下面的数字取决于你的系统 echo memory_get_usage() . "\n"; // 36640 $a = str_repeat(&q ...
- wordpress学习-plugins-001
plugins-插件 Akismet(Automattic Kismet)是应用广泛的一个垃圾留言过滤系统,其作者是大名鼎鼎的WordPress创始人Matt Mullenweg,Akismet也是W ...
- Pull解析xml
没有写抛出的异常,例子是含有多个Person对象persons.xml(此片内容未写写入的代码),包含id,name,email,address标签,Person对象含有id,name,email,a ...