It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HEAD method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HEAD method" Watch "HEAD method" New topic

HEAD method

Veri Strora

Joined: Feb 04, 2003
Posts: 27
Hi All!
I would like to know: How can I simulate a Http HEAD request from the browser to a server, for testin a servlet?
Thanks, Veri.
amol re
Ranch Hand

Joined: Mar 21, 2002
Posts: 36
I dont know how you could do that from a browser.
But lets say i want to send a HEAD request for the resource at http://localhost:8080/index.jsp
I would do the following:
(actually tried works)
1. Goto DOS prompt

>telnet localhost 8080
HEAD /index.jsp HTTP/1.0
Host: localhost


[dont forget to hit enter twice]
I get the following reply:

HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=A540757E5EFAFD11D54ADF0C44D56F16; Path=/
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Tue, 29 Jul 2003 11:38:45 GMT
Server: Apache Coyote/1.0
Connection to host lost.
Press any key to continue...
Dani Mazzuca
Ranch Hand

Joined: May 21, 2003
Posts: 70
also, if you have the Core Servlets and JSP book, you can use the sample WebClient to simulate a client browser through which you can send any http header, like the HEAD one you want. This book and its examples are also free for downloading at
Of course, you can code you own program to conect to a webserver (port 80 or 8080) and send the corresponding headers.
Veri Strora

Joined: Feb 04, 2003
Posts: 27
Thank You very much!
It is functionable and veri usefull for studying scope.
Still thanks, Veri!
I agree. Here's the link:
subject: HEAD method
It's not a secret anymore!