Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Conditional GET operation

 
Fisher Daniel
Ranch Hand
Posts: 582
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am confused about conditional GET operation.
Can you eplain about the relation of conditional GET operation and getLastModified method in HttpServlet class ?
thanks
daniel
 
Maha Annadurai
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a related link on this topic 'Conditional Get'
http://condor.depaul.edu/~mgehard/se452/lecture/lecture4.html
When the reqeust header If-Modified-Since is present in the request it is called a conditional get.
Advantage: reduce network traffic and server load
Steps:
User request a page that is cached in the browser
Browser sends a conditional get to server
Checks page modification date against the date sent from browser
If page has changed after date sent, page is sent
If page has not changed, a 304 (Not Modified) response is sent
Using conditional gets in servlets
Two methods:
Explicitly set Last-Modified header
long t = System.currentTimeMilis();
response.setDateHeader("Last-Modified", t);

Override getLastModified() method in HttpServlet
long getLastModified(HttpServletRequest request){
return System.currentTimeMilis();
}
Regards,
Maha Anna
[ November 23, 2002: Message edited by: Maha Annadurai ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic