Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HEAD method

 
Veri Strora
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 it..it 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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 http://www.coreservlets.com/.
Of course, you can code you own program to conect to a webserver (port 80 or 8080) and send the corresponding headers.
Dani
 
Veri Strora
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much!
It is functionable and veri usefull for studying scope.
Still thanks, Veri!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic