从本地主机切换到服务器后,在多路齐发请求中发送的数据被接收为空

时间:2018-12-27 17:17:08

标签: php android

我的分段截击请求在localhost上运行正常,但是切换到服务器上收到的服务器数据后为空

private void getGamesByDate(String url, final String date, final View view) {
    // loading or check internet connection or something...
    // ... then
    String REQUEST_TAG = "Es";
    pd.setMessage("loading");
    pd.show();
    VolleyMultipartRequest multipartRequest = new VolleyMultipartRequest(Request.Method.POST, GETGAMESBYDATE, new Response.Listener<NetworkResponse>() {
        @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
        @Override
        public void onResponse(NetworkResponse response) {

            try {

                String resultResponse = new String(response.data);


            }catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            NetworkResponse networkResponse = error.networkResponse;
            String errorMessage = "Unknown error";

            }
            Log.i("Error", errorMessage);
            error.printStackTrace();
        }
    }) {
        @Override
        protected Map<String, String> getParams() {
            Map<String, String> params = new HashMap<>();
            params.put("date",date);
            return params;
        }

        @Override
        protected Map<String, DataPart> getByteData() {
            Map<String, DataPart> params = new HashMap<>();
            // file name could found file base or direct access from real path
            // for now just get bitmap data from ImageView
            //  Drawable myIcon = getResources().getDrawable( R.drawable.image_1 );



            return params;
        }
    };
    multipartRequest.setRetryPolicy(new DefaultRetryPolicy(15000,1,1f));
    AppSingleton.getInstance(getContext()).addToRequestQueue(multipartRequest,REQUEST_TAG);
}

这是我的多部分请求,我正在向服务器发送日期,我正在使用多部分,因为在服务器上接收到的数据应采用form-data格式

0 个答案:

没有答案