IntelliJ Java IDE
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes ask for examples! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "ask for examples!" Watch "ask for examples!" New topic
Author

ask for examples!

Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
who can give me some examples about setIntHeader() and setDateHeader() methods?


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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 ]
 
 
subject: ask for examples!
 
Threads others viewed
Abstraction and Encapsulation
Byte vs Character streams
jsp examples
a delegation event model
Classes and Constraints Big doubt
MyEclipse, The Clear Choice