开发者

How to post HEAD request with HtmlUnit?

开发者 https://www.devze.com 2022-12-19 17:38 出处:网络
How can I use existing WebClient to post a custom HEAD request? I.e. there is no开发者_如何学Python form on the page, I want to set request properties manually.Use WebClient#getPage() where you pass t

How can I use existing WebClient to post a custom HEAD request? I.e. there is no开发者_如何学Python 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.

Thus, basically:

Page page = webClient.getPage(new WebRequestSettings(new URL("http://stackoverflow.com"), HttpMethod.HEAD));
0

精彩评论

暂无评论...
验证码 换一张
取 消