• 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

addDateHeader()

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me how to user addDateHeader() method??
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic