• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doHead method

 
Greenhorn
Posts: 25
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can i implement the doHead method ???
Which headers do i have to set explicitly in the doHead method ?
Which headers are set implicitly by the Servlet Container ?
What about the Last-Modified and If-Modified-Since headers ?

Say For Example :-
If a resource requested by a client is big (say 50 MB) , then we have to write the doHead() method, in which i would get last modified time and compare it with the If-Modified-Since header of the request and then send the response to the client ???
And if there is a change in the resource, then the client would send a GET request.

How does the browser send a HEAD and GET request. Is it related to browser programming ???
Or how could i send a HEAD request to the server if i wanted to ???

How to implement the getLastModified() method ???
Also how to implement the doHead() method ???

Could anybody please help me with the java code for these methods ???
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HEAD is not about headers at all. HEAD should do exactly the same as GET, except that it returns an empty HTTP body.
 
Rohit W. Tawde
Greenhorn
Posts: 25
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anybody provide me the code which has proper implementation of the doHead() method for the example stated above.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read NotACodeMill.

Do you even know what you want to do in these methods? If not, why do you think that they even need to be implemented? If you do, lists the steps that your code needs to take and we can address them one by one.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic