How can I use existing WebClient to post a custom HEAD request? 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
.
Thus, basically:
Page page = webClient.getPage(new WebRequestSettings(new URL("http://stackoverflow.com"), HttpMethod.HEAD));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.