2017-02-18 66 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