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 ...
随机推荐
- 谈谈 React.js 的核心入门知识
近来React.js变得越来越流行,本文就来谈一谈React.js的入门实践,通过分析一些常用的概念,以及提供一些入门 的最佳编程编程方式,仅供参考. 首先需要搞懂的是,React并不是一个框架,Re ...
- 必须会的SQL语句(三)插入
1.规范一些使用插入语句的小规范 1)中文字符串前 最好 加一个N 2)列名用中括号 扩起来 像这样 [列名] 2.常规写法 Insert into tableName ( [col ...
- Linux中与环境变量相关的函数
1.在终端可以通过env.set命令查看当前的环境变量 2.通过main函数中的第三个参数可以得到当前进程的环境变量列表 int main(int argc , char *argv[] , char ...
- Retrieve Only First x Rows
From time to time you may have the need to grab the top X number of rows returned from a table. For ...
- What is the difference between differed processing mode and interactive mode?
Every time you access and navigate through the fields on a page in PeopleSoft there are events such ...
- MongoDB的主要特性概述
一.文档数据模型 文档是一组属性名和属性的集合.相较于关系数据库复杂的规范化,面向文档的数据模型很容易以聚合的形式来表示数据.文档采用无Schema的形式,这种做法带来了一定的优势:首先,由应用程序, ...
- shell字符串操作详解
shell字符串操作详解的相关资料. 1.shell变量声明的判断 表达式 含义 ${var} 变量var的值, 与$var相同 ${var-DEFAULT} 如果var没有被声明, 那么就以$DE ...
- Java实现抽奖游戏
代码如下: import java.io.*; public class PresentDemo { /** * @param args */ public static void main(Stri ...
- 支付宝收款连接 非API
<a href="https://shenghuo.alipay.com/send/payment/fill.htm?_form_token=mMYOrAXfReOtBBCMmoaK7 ...
- Python之mongodb操作
1.安装驱动pymongo 输入命令:pip install pymongo 2.直接使用驱动 #encoding=utf-8 from pymongo import MongoClient clie ...