2017-02-18 68 views
0

我使用抽射发送获取method.Sometimes我有502网关服务器error.I不知道什么是错误的或我怎么能解决我的问题凌空扔502网关

这是一个源代码

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); 
} 

当我把我的请求,与浏览器我没有任何errors.How我可以修复这个错误... 我怎么能与排球请求头浏览器的请求头结合? 谢谢

回答

0

无法评论这么张贴在这里。大多数情况下,当总响应时间大于排放重试时间时,会发生这种情况。

+0

我怎样才能提高凌空重试时间? @ phoenix911 – BekaKK

+0

只是将DefaultRetryPolicy.DEFAULT_MAX_RETRIES更改为0并检查 – phoenix911

+0

为什么0? @ phoenix911 – BekaKK

0

如果您正在使用改造,请增加读超时会话。 或者在凌乱的情况下,请求时间会话从其默认的

中进行交叉检查直接在网页浏览器中点击网址并计算获取响应所需的时间(根据您设置的请求的时间)会议时间

这是因为,如果你的网络的lib没有得到预定义的请求时间响应显示它坏网关502