• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP response header

 
Subil Abraham
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javax.servlet.http.HTTPServletResponse interface provides a setHeader(String header, String value) and an addHeader(String header, String value) method.
Is there any difference between these two methods or do they provide the same functionality ?
Thanks
Subil
 
Jason Qiu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
addDateHeader, addHeader, addIntHeader
will always add a response header with the given name and integer value. This method allows response headers to have multiple values.
you can then use
request.getHeaders(name) to retrieve the muliple values of one header name.
setHeader, setDateHeader, setIntHeader
set a response header with the given name and value. If the header had already been set, the new value overwrites the previous one.
you can use
request.getHeader(name) to retrieve the single values of the header name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic