aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doHead() example needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doHead() example needed " Watch "doHead() example needed " New topic
Author

doHead() example needed

Somesh Rathi
Ranch Hand

Joined: Apr 27, 2006
Posts: 31
Hi Ranchers,
I know that Head method works exactly like the get method but it only returns the HTTP header information without any body.
However I have never seen any example till now in which doHead() is overrriden.
Hence Could you please let me know
1) How to print the HTTP Header information using doHead() i.e.what whould be defintion of overriden doHead() ?
2) How to make a HEAD request from the browser ?

Many thanks is advance !
Regards,
Somesh
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Somesh I am not a pro at this, but I think you cannot make head requests from a browser. For this I think you will have to make a small program and connect to the servlet using URL class or making a SocketConnection.

As far as doHead method is concerned, I have again not read the specs but in one of my books I read that doHead internally calls doGet and sends back only the response headers. This may be wrong as I have not read about this in any other books...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
The JavaScript XMLHttpRequest object can generate HEAD requests; see the AJAX section of http://faq.javaranch.com/java/JavascriptLinks for some pointers. (And yes, HEAD is like GET without the response body.)


Ping & DNS - updated with new look and Ping home screen widget
Somesh Rathi
Ranch Hand

Joined: Apr 27, 2006
Posts: 31
THanks Ankit & Ulf for the reply. I'll try to find out details & will get back to you for more clarification
Thanks ,
Somesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doHead() example needed
 
Similar Threads
Doubt in doHead() method
HEAD
GET and HEAD requests
How to deal with doHead method
HEAD requests.