我的Android客户端上有以下代码:
int method = Request.Method.POST;
JSONObject params = new JSONObject();
try {
params.put("data", userJson);
} catch (JSONException e) {
LogSystem.e(tag, "JsonObject - Params", e);
}
String url = "http://appdorneira.com:8001/rest/test";
// URL_USER_INFO;// + "?data='" + userJson + "'";
LogSystem.d(tag, url);
JsonObjectRequest request = new JsonObjectRequest(method, url, params,
resOk, errorListener);
queue.add(request);
但是在我的服务器中总是有这样的东西:
GET:QueryDict:{},POST:QueryDict:{}
我没有看到错误。我做错了什么?
现在,我正在使用VolleyPlus(https://github.com/DWorkS/VolleyPlus),此代码对我有效:
int method = Request.Method.POST;
String url = URL_USER_INFO;
LogSystem.d(tag, url);
StringRequest request = new StringRequest(method, url, resOk,
errorListener) {
protected Map<String, String> getParams()
throws com.android.volley.error.AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("data", userJson);
return params;
};
};
queue.add(request);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句