Will setHeader replace both values of "myHeader" or only last one? if i try request.getHeaders("myHeader") for the above response, what will i get, only "baz" or more than that.. Hope this is clear of what i am trying to ask?
setHeader public void setHeader(String name, String value) Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.
SET means overriding existing value if exist else add value . ADD means add value irrespective if name exist or not , if name did not exist creat name and add value to that name , If name Exist add one more value i.e NO overridding
Originally posted by Aruneesh Salhotra: Also there is no getHeaders() method, but getHeader().
There is a getHeaders(String) method in the javax.servlet.http.HttpServletRequest interface. It returns a Enumeration of String containing all the values associated with the specified header.