File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes retrieving cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "retrieving cookies" Watch "retrieving cookies" New topic

retrieving cookies

Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Hi, I have a servlet that extracts cookies from its HttpServletRequest's getCookies() method. But what confuses me is does the getCookies get ALL the cookies that the client has or just the ones specific to this server or even session? How does HttpServletRequest determine which cookies to return?
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
HttpServletRequest has all of the cookies that the browser sent, but the browser only sends those that are specific to that particular URL - see rfc2109 for details of how cookies are identified with URLs. One place to get a copy is:

author of:
Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Thank you so much!!
I agree. Here's the link:
subject: retrieving cookies
It's not a secret anymore!