| Author |
get Cookie by Name
|
SaurabhRc Jain
Greenhorn
Joined: Nov 17, 2011
Posts: 4
|
|
Just wondering why there is no method in HttpServletRequest to get a Cookie by passing its name as parameter, like HttpServletRequest.getCookie(java.lang.String name).
Only one method to fetch all cookies "getCookies()".
P.S. I could not find the answer after searching on the web.
|
 |
Sabarish Venkat
Ranch Hand
Joined: Jan 18, 2012
Posts: 133
|
|
|
To my view since cookies are saved by web browsers with its name,value and some optional attributes, they can retrieved with the help of objects. so Its not possible to detect by the servlets to detect the specific cookie as a string since web browsers are storing it. With the help of objects we can retrive the entire list as an array. From this array its easy for servlets to get the one you specify.
|
 |
 |
|
|
subject: get Cookie by Name
|
|
|