Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

ask for examples!

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
who can give me some examples about setIntHeader() and setDateHeader() methods?
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Xiu,
no example, but a clear info copied from Marty Halls older Servlet book, which does not cover the newest specs, but which you can get for free from the Internet:
http://pdf.coreservlets.com/
The following is from chapter7, page 3. I think the book is good, especially didactically.
(for me they could have used overloading either, but so the name of Data Type is part of the method name.)
Hall: "
In addition to the general-purpose setHeader method, HttpServlet-Response
also has two specialized methods to set headers that contain dates
and integers:
• setDateHeader(String header, long milliseconds)
This method saves you the trouble of translating a Java date in
milliseconds since 1970 (as returned by
System.currentTimeMillis, Date.getTime, or
Calendar.getTimeInMillis) into a GMT time string.
• setIntHeader(String header, int headerValue)
This method spares you the minor inconvenience of converting
an int to a String before inserting it into a header."

Axel
[ January 10, 2002: Message edited by: Axel Janssen ]
 
Let's get him boys! We'll make him read this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic