- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问题在于使用多线程时cookie已被覆盖。
我有一个 WebBot 接口(interface),其中包含 getHtmlResult 方法来发送请求并获取 html 页面结果:
import java.util.Date;
public interface WebBot {
public String getHtmlResult(Date pickedDate) throws Exception;
}
两个工具是WebBotA和WebBotB:WebBotA:
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
@Service("webBotA")
@Scope("prototype")
public class WebBotA implements WebBot{
String urlHeader = "http://booknow.jetstar.com";
String urlTailBeforeRedirect = "/Search.aspx?culture=vi-VN";
String charset = "UTF-8";
String requestMethod = "POST";
int readTimeOut = 10000;
@Override
public String getHtmlResult(Date pickedDate) throws Exception {
System.out.println("WebBot A started");
String htmlResult = "";
DateFormat df = new SimpleDateFormat("dd");
String pickedDateDay = df.format(pickedDate);
df = new SimpleDateFormat("yyyy-MM");
String pickedDateMonth = df.format(pickedDate);
Map<String, String> requestParams = initRequestParams();
String postParameters = "ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListCurrency=VND&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListFareTypes=I&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "DropDownListMarketDay1=" + pickedDateDay
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketDay2=1&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketDay3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "DropDownListMarketMonth1=" + pickedDateMonth
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketMonth2=1968-1&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24DropDownListMarketMonth3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "DropDownListPassengerType_ADT=" + 1
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "DropDownListPassengerType_CHD=" + 0
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "DropDownListPassengerType_INFANT=" + 0
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24RadioButtonMarketStructure=OneWay&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "TextBoxMarketDestination1=" + "HAN"
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketDestination2=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketDestination3=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24"
+ "TextBoxMarketOrigin1=" + "SGN"
+ "&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketOrigin2=&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24TextBoxMarketOrigin3=&ControlGroupSearchView%24ButtonSubmit=&__VIEWSTATE=%2FwEPDwUBMGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJ01lbWJlckxvZ2luU2VhcmNoVmlldyRtZW1iZXJfUmVtZW1iZXJtZSDCMtVG%2F1lYc7dy4fVekQjBMvD5&culture=vi-VN&date_picker=&go-booking=&pageToken=sLkmnwXwAsY%3D&ControlGroupSearchView%24AvailabilitySearchInputSearchView%24fromCS=yes";
try {
// Cookie manager registry
CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
URL obj = new URL(urlHeader + urlTailBeforeRedirect);
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
// Set redirect to false
conn.setInstanceFollowRedirects(false);
conn.setReadTimeout(readTimeOut);
conn.setRequestMethod(requestMethod);
for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
conn.setRequestProperty(requestParamEntry.getKey(), requestParamEntry.getValue());
}
// Send post request
conn.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(postParameters);
wr.flush();
wr.close();
// get redirect url from "location" header field
String urlTailAfterRedirect = conn.getHeaderField("Location");
// get the cookie if need, for login
String cookies = conn.getHeaderField("Set-Cookie");
// open the new connnection again
conn = (HttpURLConnection) new URL(urlHeader + urlTailAfterRedirect).openConnection();
conn.setRequestProperty("Cookie", cookies);
conn.setReadTimeout(readTimeOut);
conn.setRequestMethod(requestMethod);
for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
conn.setRequestProperty(requestParamEntry.getKey(), requestParamEntry.getValue());
}
conn.setDoOutput(true);
wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(postParameters);
wr.flush();
wr.close();
String inputLine;
InputStream connectionInputStream = conn.getInputStream();
String contentEncoding = conn.getContentEncoding();
if(contentEncoding != null){
if (contentEncoding.toLowerCase().contains("gzip")) {
connectionInputStream = new GZIPInputStream(connectionInputStream);
}
}
else{
throw new IOException("Failed to get Content Encoding. May by cause Cookie Manager");
}
BufferedReader in = new BufferedReader(new InputStreamReader(connectionInputStream, charset));
StringBuffer html = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
html.append(inputLine);
}
in.close();
htmlResult =html.toString();
}
catch (IOException e) {
System.out.println(e.toString());
}
finally{
}
return htmlResult;
}
private Map<String, String> initRequestParams(){
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("User-Agent", "Mozilla/5.0");
requestParams.put("Accept-Language", "en-US,en;q=0.5");
requestParams.put("Content-Type", "application/x-www-form-urlencoded");
requestParams.put("Accept-Charset", charset);
requestParams.put("Host", "booknow.jetstar.com");
requestParams.put("Referer", "http://www.jetstar.com/vn/vi/home");
requestParams.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
requestParams.put("Accept-Encoding", "gzip, deflate");
requestParams.put("Connection", "keep-alive");
return requestParams;
}
}
WebBotB:
@Service("webBotB")
@Scope("prototype")
public class WebBotB implements WebBot{
String urlNoSessionId = "https://ameliaweb5.intelisys.ca/VietJet/ameliapost.aspx?lang=en";
String urlWithSessionId = "https://ameliaweb5.intelisys.ca/VIETJET/TravelOptions.aspx?lang=en&st=pb&sesid=";
String charset = "UTF-8";
String requestPostMethod = "POST";
String requestGetMethod = "GET";
int readTimeOut = 10000;
@Override
public String getHtmlResult(Date pickedDate) throws Exception {
System.out.println("WebBot B started");
String htmlResult = "";
DateFormat df = new SimpleDateFormat("dd");
String departDayStr = df.format(pickedDate);
df = new SimpleDateFormat("yyyy-MM");
String departMonthStr = df.format(pickedDate).replaceAll("-", "%2F");
Date currentDate = new Date();
df = new SimpleDateFormat("dd");
String currentDayStr = df.format(currentDate);
df = new SimpleDateFormat("yyyy-MM");
String currentMonthStr = df.format(currentDate).replaceAll("-", "%2F");
Map<String, String> requestParams = initRequestParams();
String postParameterRequest1 = "chkRoundTrip=&"
+ "lstOrigAP=" + "SGN"
+ "&lstDestAP=" + "HAN"
+ "&dlstDepDate_Day=" + departDayStr
+ "&dlstDepDate_Month=" + departMonthStr
+ "&dlstRetDate_Day=" + departDayStr
+ "&dlstRetDate_Month=" + departMonthStr
+ "&lstCurrency=VND&lstResCurrency=VND&lstDepDateRange=0&lstRetDateRange=0&"
+ "txtNumAdults=" + 1
+ "&txtNumChildren=" + 0
+ "&txtNumInfants=" + 0
+ "&lstLvlService=1&blnFares=False&txtPromoCode=";
String postParameterRequest2 = "__VIEWSTATE=%2FwEPDwULLTE1MzQ1MjI3MzAPZBYCZg9kFg4CCA8QZGQWAGQCCQ8QZGQWAGQCCw8QZGQWAGQCDQ8QZGQWAGQCEQ8QZGQWAGQCEg8QZGQWAGQCEw8QZGQWAGRkDuhQN17CT5ZIydlFFSt%2BWc8NsCA%3D&__VIEWSTATEGENERATOR=BA3C3B49&SesID=&DebugID=62&lstOrigAP=-1&lstDestAP=-1&"
+ "dlstDepDate_Day=" + currentDayStr
+ "&dlstDepDate_Month=" + currentMonthStr
+ "&lstDepDateRange=0&dlstRetDate_Day=" + currentDayStr
+ "&dlstRetDate_Month=" + departMonthStr
+ "&lstRetDateRange=0"
+ "&txtNumAdults=0"
+ "&txtNumChildren=0"
+ "&txtNumInfants=0"
+ "&lstLvlService=1&lstResCurrency=VND&lstCurrency=VND&txtPromoCode=";
try{
CookieHandler.setDefault(null);
// Begin step 1
URL objectURLForRequest1_2 = new URL(urlNoSessionId);
HttpURLConnection connection1 = (HttpURLConnection) objectURLForRequest1_2.openConnection();
// Set redirect to false
connection1.setInstanceFollowRedirects(false);
connection1.setReadTimeout(readTimeOut);
connection1.setRequestMethod(requestPostMethod);
for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
connection1.setRequestProperty(requestParamEntry.getKey(), requestParamEntry.getValue());
}
connection1.setFixedLengthStreamingMode(postParameterRequest1.length());
// Send post request
connection1.setDoOutput(true);
DataOutputStream dataOutputStream = new DataOutputStream(connection1.getOutputStream());
dataOutputStream.writeBytes(postParameterRequest1);
dataOutputStream.flush();
dataOutputStream.close();
String cookieInRequest1String = connection1.getHeaderField("Set-Cookie");
// Get session id for request 3
String sessionIdForRequest3 = "";
List<HttpCookie> cookies = HttpCookie.parse(cookieInRequest1String);
for (HttpCookie httpCookie : cookies) {
if (httpCookie.getName().equals("ASP.NET_SessionId"))
{
sessionIdForRequest3 = httpCookie.getValue();
break;
}
}
// Begin step 2
HttpURLConnection connection2 = (HttpURLConnection) objectURLForRequest1_2.openConnection();
// Set redirect to false
connection2.setInstanceFollowRedirects(false);
connection2.setReadTimeout(readTimeOut);
connection2.setRequestMethod(requestPostMethod);
for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
connection2.setRequestProperty(requestParamEntry.getKey(), requestParamEntry.getValue());
}
connection2.setRequestProperty("Cookie", cookieInRequest1String);
connection2.setFixedLengthStreamingMode(postParameterRequest2.length());
// Send post request
connection2.setDoOutput(true);
dataOutputStream = new DataOutputStream(connection2.getOutputStream());
dataOutputStream.writeBytes(postParameterRequest2);
dataOutputStream.flush();
dataOutputStream.close();
// Ommit this connection2.getInputStream will lead to Session Expired !
@SuppressWarnings("unused")
InputStream connectionInputStream2 = connection2.getInputStream();
// Begin step 3
urlWithSessionId = urlWithSessionId + sessionIdForRequest3;
URL objectURLForRequest3 = new URL(urlWithSessionId);
HttpURLConnection connection3 = (HttpURLConnection) objectURLForRequest3.openConnection();
connection3.setRequestMethod(requestGetMethod);
connection3.setRequestProperty("Cookie", cookieInRequest1String);
for (Map.Entry<String, String> requestParamEntry : requestParams.entrySet()) {
connection3.setRequestProperty(requestParamEntry.getKey(), requestParamEntry.getValue());
}
String inputLine;
InputStream connectionInputStream = connection3.getInputStream();
String contentEncoding = connection3.getContentEncoding();
if (connection3.getContentEncoding() != null){
if (contentEncoding.toLowerCase().contains("gzip")) {
connectionInputStream = new GZIPInputStream(connectionInputStream);
}
if (contentEncoding.toLowerCase().contains("deflate")){
connectionInputStream = new DeflaterInputStream(connectionInputStream);
}
}
BufferedReader in = new BufferedReader(new InputStreamReader(connectionInputStream, charset));
StringBuffer html = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
html.append(inputLine);
}
in.close();
htmlResult = html.toString();
}
catch (IOException e) {
System.out.println(e.toString());
}
finally{
}
return htmlResult;
}
private Map<String, String> initRequestParams(){
Map<String, String> requestParams = new HashMap<String, String>();
requestParams.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2329.0 Safari/537.36");
requestParams.put("Accept-Language", "en-US,en;q=0.5");
requestParams.put("Content-Type", "application/x-www-form-urlencoded");
requestParams.put("Accept-Charset", charset);
requestParams.put("Host", "ameliaweb5.intelisys.ca");
requestParams.put("Referer", "https://ameliaweb5.intelisys.ca/VietJet/ameliapost.aspx?lang=vi");
requestParams.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
requestParams.put("Accept-Encoding", "gzip, deflate");
requestParams.put("Connection", "keep-alive");
return requestParams;
}
}
我使用实现 Runnable 的 WebBotThread.java 来运行多个线程:
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import core.WebBot;
import core.WebBotA;
import core.WebBotB;
@Component("webBotThread")
@Scope("prototype")
public class WebBotThread implements Runnable{
@Autowired
AutowireCapableBeanFactory factory;
private Date pickedDate;
private int webBotType;
public WebBotThread(){}
@Override
public void run() {
WebBot webBot = null;
if (webBotType == 1)
{
webBot = (WebBotA)factory.getBean("webBotA");
}
else{
webBot = (WebBotB)factory.getBean("webBotB");
}
try {
webBot.getHtmlResult(pickedDate);
if(webBotType == 1)
System.out.println("WebBotA finished successfully");
else
System.out.println("WebBotB finished successfully");
} catch (Exception e) {
if(webBotType == 1)
System.out.println("WebBotA failed: " + e.toString());
else
System.out.println("WebBotB failed: " + e.toString());
}
}
public Date getPickedDate() {
return pickedDate;
}
public void setPickedDate(Date pickedDate) {
this.pickedDate = pickedDate;
}
public int getWebBotType() {
return webBotType;
}
public void setWebBotType(int webBotType) {
this.webBotType = webBotType;
}
}
我的 Main.java 类:
import java.util.Calendar;
import java.util.Date;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
public class Main {
public static void main(String[] args) {
try {
@SuppressWarnings("resource")
ApplicationContext context = new ClassPathXmlApplicationContext( "classpath:spring/applicationContext.xml");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2015);
cal.set(Calendar.MONTH, Calendar.APRIL);
cal.set(Calendar.DAY_OF_MONTH, 30);
Date pickedDate = cal.getTime();
ThreadPoolTaskExecutor threadPoolTaskExecutor = (ThreadPoolTaskExecutor) context.getBean("ticketFinderBoExecutor");
WebBotThread wbThreadA = context.getBean(WebBotThread.class);
wbThreadA.setWebBotType(1);
wbThreadA.setPickedDate(pickedDate);
WebBotThread wbThreadB = context.getBean(WebBotThread.class);
wbThreadB.setWebBotType(2);
wbThreadB.setPickedDate(pickedDate);
threadPoolTaskExecutor.execute(wbThreadA);
threadPoolTaskExecutor.execute(wbThreadB);
} catch (Exception e) {
e.printStackTrace();
}
}
}
我的applicationContext-thread.xml设置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"
default-autowire="byName">
<bean id="ticketFinderBoExecutor"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="2" />
<property name="WaitForTasksToCompleteOnShutdown" value="true" />
</bean>
</beans>
我的applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"
default-autowire="byName">
<context:spring-configured/>
<import resource="applicationContext-thread.xml" />
<!-- Declare for annotation -->
<context:annotation-config />
<!-- Declare for transaction manager -->
<tx:annotation-driven />
<!-- Auto scan Beans to Spring container -->
<context:component-scan
base-package="core
, helper
, thread" />
</beans>
我的问题是,当我在 applicationContext-thread.xml 中仅设置 1 个线程池时,两个 WebBotA 和 WebBotB 运行正常。但是,当我设置2个线程池同时运行WebBotA和WebBotB时,两个WebBot实现之一将出现异常。我找到了这个topic的Wurstbro也许和我有同样的问题,但是,当我将他的解决方案应用于我的上下文时,我也失败了。我已经研究了很多,但仍然没有找到解决我的问题的方法。请帮助我,非常感谢。
P/s:请原谅我,我的英语不好。
最佳答案
您在 URL 实例上调用 openConnection。这将返回一个 HttpUrlConnection 实例。
默认Java只会通过标准UrlStreamHandlerFactory创建一次UrlStreamHandler。这意味着,如果您的应用程序使用多个 UrlConnection,则它始终使用相同的 UrlStreamHandler。这就是您的 cookie 被共享的原因。
如何解决?
或者您创建自己的 UrlStreamHandlerFactory 并强制使用 ThreadLocals 进行某些操作以获得不同的 cookie。对我来说似乎并不容易。
或者你切换到另一个库来处理 URL。我鼓励使用 Apache Http Client 库中的 HttpClient。如果您实例化 2 个 HttpClient,它们将不会共享 cookie。
据我所知,您正在使用 Spring 框架,因此使用 Apache Http Client 库肯定不会有问题。
如果你在实现过程中遇到困难,请大声喊叫!
关于java - 多线程中的cookie覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29456613/
在我的主要组件中,我有: mounted() { window.$cookie.set('cookie_name', userName, expiringTime); }, 这会产生以下错误:
我正在学习 cookie,并且我想知道在编写依赖 cookie 来存储状态的 Web 应用程序时浏览器的支持情况。 对于每个域/网站,可以向浏览器发送多少个 Cookie,大小是多少? 如果发送并存储
我已经为我的站点设置了一个 cdn,并将其用于 css、js 和图像。 网站只提供那些文件 我的问题是 firefox 中的页面速度插件对于我的图片请求,我看到了一个 cookie Cookie fc
在阅读了 Internet 上的文档和帖子后,我仍然无法解决 jMeter 中的 Cookie Manager 问题。 我在响应头中得到了 sid ID,但它没有存储在我的 cookie 管理器中。
我正在 Node.JS 中处理一些类似浏览器的 cookie 处理,想知道从 NodeJS and HTTP Client - Are cookies supported? 开始对这段代码进行扩展到什
我正在此堆栈上构建自托管 Web 服务器:欧文南希网络 API 2 我正在使用 Katana 的 Microsoft.Owin.Security.Cookies 进行类似表单的身份验证。我得到了 Se
我有一个从另一个网站加载资源的网站。我已经能够确定: 第三方网站在用户的浏览器上放置 cookie。 如果我在浏览器设置中禁用第三方 cookie,第三方网站将无法再在浏览器上放置 cookie。 该
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我正在使用 python mechanize 制作登录脚本。我已经读到 Mechanize 的 Browser() 对象将自动处理 cookie 以供进一步请求。 我怎样才能使这个 cookie 持久
我正在尝试在 www.example.com 和 admin.other.example.com 之间共享 cookie 我已经能够使其与 other.example.com 一起使用,但是无法访问子
我设置了一个域为 .example.com 的 cookie .它适用于我网站上的每个一级子域,应该如此。 但是,它不适用于 n 级子域,即 sub.subdomain.example.com和 to
我想让用户尽可能长时间地登录。 我应该使用什么? 普通 cookies 持久性 cookie 快闪 cookies ip地址 session 或这些的某种组合? 最佳答案 我认为 Flash cook
如果给定的 Web 服务器只能读取其域内设置的 cookie,那么 Internet 广告商如何从其网络外的网站跟踪用户的 Web 流量? 是否存在某种“supercookie”全局广告系统,允许广告
我知道一个 cookie 可以容纳多少数据是有限制的,但是我们可以设置多少个 cookie 有限制吗? 最佳答案 来自 http://www.ietf.org/rfc/rfc2109.txt Prac
如果我拒绝创建 cookie,则在我的浏览器中创建名称为 __utma、__utmb 等的 cookie。我认为这个 cookie 是用于谷歌分析的。任何人都知道谷歌如何创建这个 cookie,即使浏
我有一个生产环境和一个登台环境。我想知道我是否可以在环境之间沙箱 cookie。我的设置看起来像 生产 domain.com - 前端 SPA api.domain.com - 后端节点 分期 sta
我想知道浏览器(即 Firefox )和网站的交互。 当我将用户名和密码提交到登录表单时,会发生什么? 我认为该网站向我发送了一些 cookie,并通过检查这些 cookie 来授权我。 cookie
我在两个不同的域中有两个网络应用程序 WebApp1 和 WebApp2。 我在 HttpResponse 的 WebApp1 中设置 cookie。 如何从 WebApp2 中的 HttpReque
我正在使用Dartium“Version 34.0.1847.0 aura(264987)”,并从Dart创建一个websocket。但是,如果不是httpOnly,我的安全 session cook
我从 Headfirst Javascript 书中获取了用于 cookie 的代码。但由于某种原因,它不适用于我的浏览器。我主要使用chrome和ff,并且我在chrome中启用了本地cookie。
我是一名优秀的程序员,十分优秀!