Reputation: 34424
i have successfully set the httpServletResponse().setHeader("custtype", "permanent") but when i try to retrieve it httpServletResponse().getHeader("custtype") i do not see getheader method when i do control + soace in eclipse but as per doc at http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html its there. I am not sure why getHeader method is not visible here in eclipse.?
How i can i get header from response?
Upvotes: 5
Views: 18025
Reputation: 15446
getHeaders(...) methods HttpServletResponse are supported since Servlet 3.0., Before this version you can find only setHeader(...) methods.
For earlier version you can try wrapping the response and implement storing the headers in your wrapper class.
Upvotes: 5
Reputation: 1333
Maybe you are using the earlier version of Java. getHeader(String)
has been added since its version 3.0. If you want to add it, upgrade your Java version.
Upvotes: 0
Reputation: 140032
Since: Servlet 3.0
setHeader
was added in Servlet 3.0. Perhaps your Eclipse instance is using documentation for an earlier version.
Upvotes: 2
Reputation: 2795
HttpServletResponse.getHeader()
function is available in HttpServletResponse
class.
Upvotes: -1