File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 63540

Most often to describe the content.

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

Joined: Aug 03, 2008
Posts: 9452

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: doubt regarding HttpServletResponse.addHeader method
It's not a secret anymore!