Comments (1)
这个你要先了解Cookie和Session的区别。
- Cookie分为临时Cookie和有效期Cookie,Session是一种临时Cookie。
- 设置有效期的Cookie,设置了一个小时,你用了半个小时候,App退出了或者关机了,那么你下次打开App时NoHttp还会继续维持这个有效期Cookie,直到这个Cookie失效。
- Session和临时Cookie,只在本次客户端处于工作状态时小时,一当客户端关闭,这个cookie即被客户端删除。(即视为失效的cookie,下次启动时不会被提交,有可能可能是下次启动时删除,删除的时机不定。)
- session的保持机制这个你可以去我博客上找关于NoHttp Cookie的文章,这个讲起来就麻烦了。
关于怎么使用,NoHttp内部是使用的数据库做了持久化,自动维护的,按照标准的Http协议。如果你要让你的Session在App重启后还可以用,那你就要自己维护Cookie了:
- 禁用NoHttp自动维护Cookie:NoHttp.setEnableCookie false。
- 在请求到结果后拿到相应头的cookie,并保存。
- 下一次请求时带上发送这个cookie到服务器。
from nohttp.
Related Issues (20)
- RequestQueue多并发实现问题
- 请求头部的添加,自动把键值的首字母改成大写 HOT 1
- 上传进度条问题new FileInputStream(file), "application/octet-stream" 如何设置上传进度条 HOT 1
- 上传请求的数据中包含list list里面是map数据,请问如何上传 HOT 5
- 你好问下表单提交file能拿到上传进度的回调吗
- 报错 v1.1.11 HOT 1
- 使用studio3.2版本在安卓9.0机型请求失败
- 多文件上传 bug HOT 1
- Ftp下载 HOT 1
- 不回调success,Debug发现报 java.util.concurrent.CancellationException
- 设置返回编码无效
- NoHttpSample: java.net.SocketException: socket failed: ENONET (Machine is not on the network)
- 支持https不
- 同步请求数据返回为 “”, 同样的url 异步请求没问题
- post请求中文乱码
- The network is not available, please check the network
- target 29 下载报权限异常 HOT 1
- NoHttpSample: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR HOT 1
- 为什么下载后文件正常但是重启设备后文件的后缀多了.nohttp 导致文件异常
- 请求头部的添加,自动把键值的首字母改成大写 ,这个有方法避免吗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nohttp.