【发布时间】:2017-07-08 04:43:38
【问题描述】:
我正在使用 Volley 发送 Get 方法。有时我有 502 bad gateway server error。我不知道是什么问题或如何解决我的问题
这是源代码
public void polygonRequest(final String userID, final String secretKey) {
showpDialog("loading");
polygonModelList.clear();
String url = ServerUtil.polygon+userID+"/"+secretKey;
final JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
SavedPolygonJson polygonModel=new SavedPolygonJson();
polygonModel.setPolygonJson(response.toString());
polygonModel.saveInStorage();
parsePolygonRequest(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
hidepDialog();
showOneItemDialog(error.toString(),false);
}
});
jsObjRequest.setRetryPolicy(new DefaultRetryPolicy(
10000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
CoreApplication.getInstance().getRequestQueue().add(jsObjRequest);
}
当我使用浏览器发送我的请求时,我没有任何错误。我该如何解决这个错误... 我如何将浏览器的请求标头与 Volley 请求标头结合起来? 谢谢
【问题讨论】:
-
不能发表评论,所以在这里发帖。这通常发生在总响应时间大于截击重试时间时
标签: android android-volley http-get