gpt4 book ai didi

安卓 Volley : Why does the second request of these two requests fail with a timeout?

转载 作者:行者123 更新时间:2023-12-05 00:03:29 25 4
gpt4 key购买 nike

这听起来很简单,我使用 volley 来请求两个 JSON 数据包,但是第二个失败了——如果我把第一个丢掉,一切都会成功。如果我多次重新查询 test1(),它甚至会失败。

    private void test1()
{
JsonArrayRequest req =
new JsonArrayRequest(Request.Method.GET,
"https://www.impfterminservice.de/assets/static/its/vaccination-list.json",
null,
new Response.Listener<JSONArray>()
{
@Override
public void onResponse(JSONArray response)
{
test2();
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
test2();
}
}
);
BaseMainApp.getVolleyRequestQueue(m_Context).add(req);
}

private void test2()
{
JsonObjectRequest req =
new JsonObjectRequest(Request.Method.GET,
"https://002-iz.impfterminservice.de/rest/suche/termincheck?plz=78224&leistungsmerkmale=L922",
null,
new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
// does not arrive here
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
// OUCH!!!
}
}
);
BaseMainApp.getVolleyRequestQueue(m_Context).add(req);
}

我以为可能是cookie缓存,但我没有缓存试过

        Cache   cache   = new NoCache();
Network network = new BasicNetwork(new HurlStack());

m_VolleyRequestQueue = new RequestQueue(cache, network);
m_VolleyRequestQueue.start();

或者我试图删除缓存,...无济于事。我还尝试延迟第二个查询,创建一个新的 RequestQueue,...我真的需要重新启动应用程序!

那里发生了什么?是什么导致服务器拒绝我的请求(并超时拒绝)?

顺便说一下 - 如果第一个查询没有完成,第二个查询可以被调用多次,所以我猜第一个查询以某种方式设置了一些状态......不管它是什么?

最佳答案

解决办法:服务器故意为之...!

关于安卓 Volley : Why does the second request of these two requests fail with a timeout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66490309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com