JsonObjectRequest jor = new JsonObjectRequest(JsonObjectRequest.Method.POST, url, json, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d("glamour", response.toString());
Toast.makeText(WelcomeActivity.this, "onResponse: " + response.toString(), Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//Log.e("glamour", error.getMessage());
error.printStackTrace();
Toast.makeText(WelcomeActivity.this, "onErrorResponse: " + error.getMessage(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = new HashMap<>();
headers.put("Accept", "application/json");
headers.put("Content-Type", "application/json; charset=UTF-8");
return headers;
}
};
mQueue.add(jor);
错误信息:BasicNetwork.performRequest: http: //192.168.1.103 :8080/appapi/customer/login/v3 的意外响应代码 415
如何解决?请帮忙。