<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 被覆盖

      Android Volley, duplicate Set-Cookie is overridden(Android Volley,重复的 Set-Cookie 被覆盖)
          <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 被覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Cannot solve SonarQube error quot;Make this line start at column 3quot;(无法解决 SonarQube 错误“使此行从第 3 列开始)
                SonarQube for multi module project for Android(适用于 Android 的多模块项目的 SonarQube)
                How to integrate sonarqube in android studio?(如何在 android studio 中集成 sonarqube?)
                Android What is the easist way Upgrade Database for existing DB(Android 为现有数据库升级数据库的简单方法是什么)
                Updating SQLite database android(更新 SQLite 数据库 android)
                Android: onUpgrade not calling at database upgrade(Android:onUpgrade 不在数据库升级时调用)
                <tfoot id='vfHtN'></tfoot>

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

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

                      <tbody id='vfHtN'></tbody>

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

                        • <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>