[英]How to post HEAD request with HtmlUnit?
How can I use existing WebClient to post a custom HEAD request? 如何使用现有WebClient发布自定义HEAD请求? Ie there is no form on the page, I want to set request properties manually.
即页面上没有表单,我想手动设置请求属性。
Use WebClient#getPage()
where you pass the WebRequestSettings
in which you can construct with a HttpMethod
of HEAD
. 使用
WebClient#getPage()
,您可以在其中传递可以使用HEAD
的HttpMethod
构造的WebRequestSettings
。
Thus, basically: 因此,基本上:
Page page = webClient.getPage(new WebRequestSettings(new URL("http://stackoverflow.com"), HttpMethod.HEAD));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.