We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何获取cookie?
The text was updated successfully, but these errors were encountered:
Cookie是可以获取的。 第一点必须要知道的:首先NoHttp自动维持了Cookie。 第二:获取单个请求的Cookie,在响应的时候response.getHeaders().getCookies()。 第三:如果需要向webView共享Cookie,那么就要获取这个url下所有的cookie:
response.getHeaders().getCookies()
try { URI uri = new URI(url); if (uri != null) { CookieStore cookieStore = ((MaMaCookieManager) NoHttp.getDefaultCookieHandler()).getCookieStore(); List<HttpCookie> cookies = cookieStore.get(uri); CookieManager webCookieManager = CookieManager.getInstance(); webCookieManager.setAcceptCookie(true); for (HttpCookie cookie : cookies) { webCookieManager.setCookie(cookie.getDomain(), cookie.getName() + "=" + cookie.getValue() + "; path=" + cookie.getPath() + "; domain=" + cookie.getDomain()); } CookieSyncManager.createInstance(NoHttp.getContext()).sync(); } } catch (URISyntaxException e) { }
Sorry, something went wrong.
No branches or pull requests
如何获取cookie?
The text was updated successfully, but these errors were encountered: