This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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

Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 12683
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:

Java Resources at
Bob Moranski
Ranch Hand

Joined: Nov 22, 2000
Posts: 177
Thank you so much!!
I agree. Here's the link:
subject: retrieving cookies
Similar Threads
Question on Cookie
New to cookies
get action property
User gets logged out automatically