HtmlUnit 对 cookie 和 windows 的疑问

发布于 2024-08-18 07:43:00 字数 282 浏览 3 评论 0原文

如果 HtmlUnit 在内存中存储 cookie,那么 HtmlUnit 会用 cookie 响应服务器吗?

HtmlUnit 会话何时终止?当我调用 webclient.closeWindow() 时它会终止吗?

按照。对于HtmlUnit文档,WebClient代表一个浏览器,那么它代表一个多窗口浏览器(例如IE7,我们可以在其中打开多个选项卡)还是代表一个单窗口浏览器?

如果它代表一个多窗口浏览器,那么 HttpSession 是否像真正的浏览器一样在该 Web 客户端的多个窗口中维护?

If the HtmlUnit stores cookies in memory then Will HtmlUnit respond the server with cookies?

When the HtmlUnit session terminates? Will it terminate when i call webclient.closeWindow()?

As acc. to the HtmlUnit docs, WebClient represents a browser, so Is it represent a mutiple-windows browser (like IE7 in which we can open multiple tabs) or represen a single-window browser?

If it represents a multiple-window browser, then does the HttpSession is maintained accross multiple windows of that webclient like real browsers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不再让梦枯萎 2024-08-25 07:43:00

不是真正的答案,而是一些提示。

如果 HtmlUnit 在内存中存储 cookie,那么 HtmlUnit 会用 cookie 响应服务器吗?

HtmlUnit 的 cookie 策略是与浏览器兼容的,所以我希望它能够这样做。

HtmlUnit 会话何时终止?当我调用 webclient.closeWindow() 时它会终止吗?

我对此不太确定。您是否尝试过测试或调试这个?你看过源代码吗?实际上,我想知道这里的预期行为应该是什么。

按照。在HtmlUnit文档中,WebClient代表一个浏览器,那么它代表的是多窗口浏览器(例如IE7,我们可以在其中打开多个选项卡)还是单窗口浏览器?

我认为 WebClient 代表单个选项卡式浏览器。

如果它代表一个多窗口浏览器,那么 HttpSession 是否像真正的浏览器一样在该 Web 客户端的多个窗口中维护?

请注意,这种行为在浏览器之间和浏览器版本之间并不一致:IE6、IE7、IE8、Firefox、Chrome,它们的行为(或多或少)不同(请参阅 Firefox 和 Internet Explorer 中的 Cookie,或 浏览器、进程、cookie 和会话状态会话 Cookie、sessionStorage 和 IE8< /a>)。所以我不认为“真正的”浏览器有一般规则。

实际上,我认为最好的武器是源代码和调试器。在我看来,这些问题很容易验证。

Not a real answer, but some hints.

If the HtmlUnit stores cookies in memory then Will HtmlUnit respond the server with cookies?

HtmlUnit's cookie policy is to be browser-compatible so I would expect it to do so.

When the HtmlUnit session terminates? Will it terminate when i call webclient.closeWindow()?

I'm not sure about this one. Did you try to test or debug this? Did you look at the source code? Actually, I wonder what should be the expected behavior here.

As acc. to the HtmlUnit docs, WebClient represents a browser, so does it represent a mutiple-windows browser (like IE7 in which we can open multiple tabs) or a single-window browser?

I consider that WebClient represents a single tabbed browser.

If it represents a multiple-window browser, then does the HttpSession is maintained accross multiple windows of that webclient like real browsers?

Note that this behavior is not consistent between browsers and between browser versions: IE6, IE7, IE8, Firefox, Chrome, they all behave (more or less) differently (see Cookies in Firefox and Internet Explorer, or Browsers, processes, cookies and session state, or Session Cookies, sessionStorage, and IE8). So I wouldn't consider that there is a general rule with "real" browsers.

Actually, I think that your best weapons are the source code and your debugger. These questions would be easy to verify IMO.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文