[英]Server huge json response not coming fully to mobile end using volley StringRequest
我的api請求的json響應很大(Content-Length:6199)。 我正在對HTTP請求使用volley。 這是我的代碼:
final StringRequest req = new StringRequest(com.android.volley.Request.Method.POST, url,
new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("DEBUG",response);
showOrHideProgressBar();
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
return params;
}
};
req.setRetryPolicy(new DefaultRetryPolicy(60000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
// TODO Auto-generated method stub
AppController.getInstance().addToRequestQueue(req);
但不幸的是,我的移動端無法完全回應。 我可以從logcat看到總響應的大約2/3部分即將到來。 誰能告訴我為什么在使用截擊請求時僅部分回復。 我還在此處提供了來自響應的restApi鏈接
http://173.254.242.246:8084/BGB/getPillarNames.jsp
請告訴我在這種情況下我能做什么。 提前致謝。
LogCat對單個行的長度有限制。 如果服務器響應包含6000個字符,則該字符超出限制,將被截斷。
如果您打算記錄整個響應,則應將其分成多個部分,如本答案所示 。
即使您無法記錄數據,數據本身也應該存在。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.