Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cookies htmlunit cookie/参考问题_Cookies_Htmlunit_Referer - Fatal编程技术网

Cookies htmlunit cookie/参考问题

Cookies htmlunit cookie/参考问题,cookies,htmlunit,referer,Cookies,Htmlunit,Referer,测试java HtmlUnit库。试图找出是否有办法设置/删除webclient对象使用的cookie文件(cookiejar) 我搜索了多个文档,以及HtmlUnit API,但运气不佳,所以我假设我遗漏了什么 另外,在我的测试过程中,是否有一种方法可以查看在客户机/服务器之间传递的头(请求/响应/引用) 谢谢 tom您可以使用webClient.getCookieManager(),并且可以将HttpWebConnection子类化为: webClient.setWebConnect

测试java HtmlUnit库。试图找出是否有办法设置/删除webclient对象使用的cookie文件(cookiejar)

我搜索了多个文档,以及HtmlUnit API,但运气不佳,所以我假设我遗漏了什么

另外,在我的测试过程中,是否有一种方法可以查看在客户机/服务器之间传递的头(请求/响应/引用)

谢谢


tom

您可以使用
webClient.getCookieManager()
,并且可以将HttpWebConnection子类化为:

    webClient.setWebConnection(new HttpWebConnection(webClient) {
        public WebResponse getResponse(WebRequestSettings settings) throws IOException {
            System.out.println(settings.getUrl());
            return super.getResponse(settings);
        }
    });