<legend id='GWqKs'><style id='GWqKs'><dir id='GWqKs'><q id='GWqKs'></q></dir></style></legend>

    • <bdo id='GWqKs'></bdo><ul id='GWqKs'></ul>

      <i id='GWqKs'><tr id='GWqKs'><dt id='GWqKs'><q id='GWqKs'><span id='GWqKs'><b id='GWqKs'><form id='GWqKs'><ins id='GWqKs'></ins><ul id='GWqKs'></ul><sub id='GWqKs'></sub></form><legend id='GWqKs'></legend><bdo id='GWqKs'><pre id='GWqKs'><center id='GWqKs'></center></pre></bdo></b><th id='GWqKs'></th></span></q></dt></tr></i><div id='GWqKs'><tfoot id='GWqKs'></tfoot><dl id='GWqKs'><fieldset id='GWqKs'></fieldset></dl></div>

      <small id='GWqKs'></small><noframes id='GWqKs'>

    1. <tfoot id='GWqKs'></tfoot>

      Android Volley,重复的 Set-Cookie 被覆盖

      时间:2023-07-08
          <tbody id='UQ4Q8'></tbody>
        1. <legend id='UQ4Q8'><style id='UQ4Q8'><dir id='UQ4Q8'><q id='UQ4Q8'></q></dir></style></legend>
        2. <tfoot id='UQ4Q8'></tfoot>

            <i id='UQ4Q8'><tr id='UQ4Q8'><dt id='UQ4Q8'><q id='UQ4Q8'><span id='UQ4Q8'><b id='UQ4Q8'><form id='UQ4Q8'><ins id='UQ4Q8'></ins><ul id='UQ4Q8'></ul><sub id='UQ4Q8'></sub></form><legend id='UQ4Q8'></legend><bdo id='UQ4Q8'><pre id='UQ4Q8'><center id='UQ4Q8'></center></pre></bdo></b><th id='UQ4Q8'></th></span></q></dt></tr></i><div id='UQ4Q8'><tfoot id='UQ4Q8'></tfoot><dl id='UQ4Q8'><fieldset id='UQ4Q8'></fieldset></dl></div>

          • <small id='UQ4Q8'></small><noframes id='UQ4Q8'>

              • <bdo id='UQ4Q8'></bdo><ul id='UQ4Q8'></ul>
                本文介绍了Android Volley,重复的 Set-Cookie 被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                尝试使用 Volley lib 作为我的 android 应用程序的网络包装器.我有一个连接已启动并正在运行,但问题是每次响应中有多个Set-Cookie"标头时 Volley 使用不能有重复键的 Map,并且只会存储最后一个 Set-cookie 标头并覆盖其余标头.

                Trying to use Volley lib as a network wrapper for my android application. I have a connection up and running, but the problem is that every time there is multiple "Set-Cookie" headers in the response Volley uses Map that cannot have duplicate keys, and will only store the last Set-cookie header and overwrite the rest.

                这个问题有解决办法吗?

                Is there a workaround for this issue?

                还有其他库可以使用吗?

                Is there another lib to use?

                推荐答案

                我尝试覆盖类来解决这个问题,但是当我不得不编辑 NetworkResponse,我在兔子洞里下降得太远了.所以我决定直接编辑 Volley 来获取数组中的所有响应头,而不是 Map.

                I tried overiding classes to fix this but when I had to edit NetworkResponse, I was descending too far down the rabbithole. So I decided to just edit Volley directly to grab all response headers in an array and not a Map.

                我的 fork 在 GitHub 上,我包含了一个 示例使用活动.

                My fork is on GitHub and I included an example usage activity.

                我对 NetworkResponse.java、BasicNetwork.java 和 HurlStack.java 进行了更改,详见 此提交.

                I made changes to NetworkResponse.java, BasicNetwork.java and HurlStack.java as detailed in this commit.

                然后在你的实际应用中使用你做这样的事情

                Then to use in your actual apps you do something like this

                protected Response<String> parseNetworkResponse(NetworkResponse response) {
                            // we must override this to get headers. and with the fix, we should get all headers including duplicate names
                            // in an array of apache headers called apacheHeaders. everything else about volley is the same
                            for (int i = 0; i < response.apacheHeaders.length; i++) {
                                String key = response.apacheHeaders[i].getName();
                                String value = response.apacheHeaders[i].getValue();
                                Log.d("VOLLEY_HEADERFIX",key + " - " +value);
                            }
                
                            return super.parseNetworkResponse(response);
                        }
                

                这是一个肮脏的小技巧,但目前看来对我来说效果很好.

                It's a dirty little hack but seems to work well for me at the moment.

                这篇关于Android Volley,重复的 Set-Cookie 被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 Objective-C 中暂停/恢复下载 下一篇:以编程方式设置 Android IP、DNS、GATEWAY 设置

                相关文章

                <tfoot id='vfHtN'></tfoot>

                <small id='vfHtN'></small><noframes id='vfHtN'>

                • <bdo id='vfHtN'></bdo><ul id='vfHtN'></ul>

                  <legend id='vfHtN'><style id='vfHtN'><dir id='vfHtN'><q id='vfHtN'></q></dir></style></legend>

                  1. <i id='vfHtN'><tr id='vfHtN'><dt id='vfHtN'><q id='vfHtN'><span id='vfHtN'><b id='vfHtN'><form id='vfHtN'><ins id='vfHtN'></ins><ul id='vfHtN'></ul><sub id='vfHtN'></sub></form><legend id='vfHtN'></legend><bdo id='vfHtN'><pre id='vfHtN'><center id='vfHtN'></center></pre></bdo></b><th id='vfHtN'></th></span></q></dt></tr></i><div id='vfHtN'><tfoot id='vfHtN'></tfoot><dl id='vfHtN'><fieldset id='vfHtN'></fieldset></dl></div>