The moose likes Servlets and the fly likes doubt regarding HttpServletResponse.addHeader method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doubt regarding HttpServletResponse.addHeader method" Watch "doubt regarding HttpServletResponse.addHeader method" New topic

doubt regarding HttpServletResponse.addHeader method

yogesh srinivasan
Ranch Hand

Joined: Jun 08, 2007
Posts: 55
In what ways the headers added to a response could be used ?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Most often to describe the content.

[Asking smart questions] [About Bear] [Books by Bear]
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Normally all the useful headers have a corresponding setter methods already defined in the HttpServletResponse class.
For example to set the content type you have HttpServletResponse.setContentType, for setting cookies you have HttpServletResponse.addCookie.

So normally you will not need to use HttpServletResponse.setXxxHeader() methods.

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: doubt regarding HttpServletResponse.addHeader method
jQuery in Action, 3rd edition