有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java基本网络。performRequest:意外响应代码500

我正在使用截击的POST方法发送到服务器。我正在发送两个参数,我得到了这个意外的响应代码500

以下是JsonObjectReguest代码:

final String URL

            JsonObjectRequest req = new JsonObjectRequest(Request.Method.POST,URL, null,
                    new Response.Listener<JSONObject>() {
                        @Override
                        public void onResponse(JSONObject response) {
                            try {
                                VolleyLog.v("Response:%n %s", response.toString(4));
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }
                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    VolleyLog.e("Error: ", error.getMessage());
                }
            }){
                protected HashMap<String, String> getParams() {
                    HashMap<String, String> params = new HashMap<String, String>();
                    params.put("cid", String.valueOf(id));
                    params.put("positions", string);

                    return params;
                }
                @Override
                public HashMap<String, String> getHeaders() throws AuthFailureError {
                    HashMap<String,String> headers = new HashMap<String, String>();
                    headers.put("Content-Type","application/x-www-form-urlencoded");
                    return headers;
                }
            };


            AppController.getInstance().addToRequestQueue(req);
        }

这是我的日志:

04-08 02:44:05.110 32385-32511/com.example.bukic.postexample I/System.out﹕ propertyValue:true 04-08 02:44:05.114 32385-32511/com.example.bukic.postexample I/System.out﹕ [socket][3] connection maps.b1.finki.ukim.mk/194.149.138.7:80;LocalPort=45144(2500) 04-08 02:44:05.115 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]connect[maps.b1.finki.ukim.mk/194.149.138.7:80] tm:2 04-08 02:44:05.116 32385-32511/com.example.bukic.postexample D/Posix﹕ [Posix_connect Debug]Process com.example.bukic.postexample :80 04-08 02:44:05.189 32385-32511/com.example.bukic.postexample I/System.out﹕ [socket][/192.168.1.100:45144] connected 04-08 02:44:05.189 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]rx timeout:2500 04-08 02:44:05.302 32385-32511/com.example.bukic.postexample I/System.out﹕ Shutdown rx/tx 04-08 02:44:05.303 32385-32511/com.example.bukic.postexample I/System.out﹕ [CDS]close[45144] 04-08 02:44:05.304 32385-32511/com.example.bukic.postexample I/System.out﹕ Shutdown rx/tx 04-08 02:44:05.305 32385-32511/com.example.bukic.postexample I/System.out﹕ Shutdown rx/tx 04-08 02:44:05.307 32385-32511/com.example.bukic.postexample I/System.out﹕ close [socket][/0.0.0.0:45144] 04-08 02:44:05.309 32385-32511/com.example.bukic.postexample E/Volley﹕ [3280] BasicNetwork.performRequest: Unexpected response code 500 for http://maps.b1.finki.ukim.mk/MapController/save 04-08 02:44:05.313 32385-32385/com.example.bukic.postexample E/Volley﹕ 1 2.onErrorResponse: Error:


共 (1) 个答案

  1. # 1 楼答案

    !![其中一个参数是cid][1]

    [1]:http://i.stack.imgur.com/lY1R5.jpg其中一个参数是cid

    !![其中一个参数是cId][1]

    [1]:http://i.stack.imgur.com/B0AHG.jpg其中一个参数是cId而不是cId

    我向您推荐一个名为“邮递员”的chrome扩展。我们可以发送http请求并使用它验证结果,这是非常有用的