Assume that the following header is present in a request sent to a
servlet:
Accept: image/gif, image/jpeg, image/bmp
What will be returned when the servlet code calls request.getHeader("Accept")? (from Entuware Mock)
1. A Header object containing, name as "Accept" and value as "image/gif".
2. A Header object containing, name as "Accept" and value as "image/gif, image/jpeg, image/bmp".
3. A
String array containing "image/gif"".
4. A String containing "image/gif, image/jpeg, image/bmp".
5. A String array containing "image/gif", "image/jpeg", image/bmp".
why option 4th is correct one.
I guess The method HttpServletRequest.getHeaders() returns an Enumeration in which each comma separated value can be retrieved using Enumeration.nextElement().
not request.getHeader()??
Please correct me if I am wrong
Thanks in Advance
