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 ...
随机推荐
- JS常用的设计模式(8)——访问者模式
GOF官方定义: 访问者模式是表示一个作用于某个对象结构中的各元素的操作.它使可以在不改变各元素的类的前提下定义作用于这些元素的新操作.我们在使用一些操作对不同的 对象进行处理时,往往会根据不同的对象 ...
- Android的Intent作用
Android应用程序中有三个核心组件Activity.Services.Broadcast Receiver. Intent 提供应用程序之间的的交互机制,负责对一次操作的动作,动作涉及的数据,附加 ...
- MySql安装方法和配置、解决中文乱码
MySql Server安装步骤 1安装MySql Server 2 安装MySqlServer管理工具 解压中文语言包,将文件复制到安装目录下覆盖 文件覆盖后,打开软件设置语言为中文(CN) 3 M ...
- centos -bash-4.1$ 不显示用户名路径
1.在Terminal输入: vi ~/.bash_profile 2.如果没有.bash_profile可以自己添加.然后往文件中添加如下内容: export PS1=’[\u@\h \W]$ 注意 ...
- scribe日志分析工具安装
系统CentOS6.2 x86_64 1.yum安装gcc,flex,m4,python/python-devel,ruby,libevent/libevent-devel,openssl/opens ...
- css3 2d
CSS3 2D 转换 通过 CSS3 转换,我们能够对元素进行移动.缩放.转动.拉长或拉伸. 以下是 2D 转换 1 translate()通过 translate() 方法,元素从其当前位置移动 ...
- php final static const成员属性用法
http://www.111cn.net/phper/php/38976.htm 首先来说说final 1.final不能用来修饰成员属性 2.final只能修饰类和方法 作用:被修饰的类不能被子类所 ...
- JDK 环境变量的配置
小编下载的是 jdk1.6 的版本 具体如何如何安装我相信大家肯定都会的了 这里就不做详细的说明了 , 我的jdk 安装的目录是在 D:\javac 这个目录下 下面我们来配置环境变量 在我的电脑- ...
- 平衡二叉树(AVL)
性质:它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树. 定义:平衡二叉树或为空树,或为如下性质的二叉排序树: (1)左右子树深度之差的绝对值不超过1; (2 ...
- 自适应游标共享技术01(Adaptive Cursor Sharing)
什么是ACS(adaptiver cursor sharing) Oracle通过绑定变量技术解决了SQL语句硬解析过多的问题,降低了资源的争用.但是绑定变量在引入cursor sharing,增加了 ...