Thursday 21 August 2014

Headers

HTTPServlet can set its headers via the following methods of HttpServletResponse interface.

   setHeader(String name, String value)
   addHeader(String name, String value)

Headers may contain data that represents an int or a Date object. The following convenience methods of the HttpServletResponse interface allow a servlet to set a header using the correct formatting for the appropriate data type.

   setIntHeader(String name, int value)
   setDateHeader(String name, long date)
   addIntHeader(String name, int value)
   addDateHeader(String name, long date)

Headers must set before the response committed to the client. Headers set after committing the response are ignored by servlet container.





Prevoius                                                 Next                                                 Home

No comments:

Post a Comment