Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

addDateHeader()  RSS feed

 
aman thind
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how to user addDateHeader() method??
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the API, it's fairly easy to understand how to use it :
addDateHeader API
 
aman thind
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What i meant was in which function to use this function...like doGet/doPost. I am not clear where in a program to use this function.Can you show me a sample program?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

To fully understand why (and how) you would want to use this method, it helps to have an idea how HTTP shuffles data back and forth. There's a wonderful Firefox extension called LiveHTTPheaders, which shows HTTP request and response headers as they are being made by the browser. If you use that to examine the response you're getting from some site, you'll notice that it contains a line that looks like "Date: Fri, 29 Jun 2007 10:22:12 GMT". That's an HTTP header with the name of "Date" and the value "Fri, 29 Jun 2007 10:22:12 GMT". Given that, can you guess why you might want to use the addDateHeader method?
[ June 29, 2007: Message edited by: Ulf Dittmer ]
 
aman thind
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, in doGet, i tried to addDateHeader with String and long as parameter. but when i am calling getDateHeader, it's showing -1 as output.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're calling addDateHeader on the response object, so calling getDateHeader on the request object could not possibly return that value, now could it?

You will see that value if you observe the response with something like LiveHttpHeaders in the browser.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!