5

How can I use existing WebClient to post a custom HEAD request? I.e. there is no form on the page, I want to set request properties manually.

Fluffy
  • 27,504
  • 41
  • 151
  • 234

1 Answers1

4

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));
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555