Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session management using cookies

 
Grishma Dube
Ranch Hand
Posts: 275
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I came across to this question during one of the interviews.

How do we manage a session with cookies in servlet, if suppose we dont want to use a cookie class? is it possible?

TAI

Grishma
 
smitha verghese
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there r diff ways to maintain sessions

1. hidden fields
2. url appending
3. Session objects
4. Cookies

smitha
 
Grishma Dube
Ranch Hand
Posts: 275
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Smitha, but i know the ways of tracking a session.

Pls read my question carefully. I said, how do i manage a session using cookies but without making use of Cookie class?

Grishma
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets have a little more detail - what do you mean by "manage a session"??
I'm assuming you have read the HttpSession JavaDocs - what do you want to do that is not covered there? Have you read the JavaDocs for the various session listeners?
Bill
 
Rovas Kram
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the interviewer is looking for:

Use HttpServletRequest.getHeader(String) which can be used to get the cookies as a String instead of HttpServletRequest.get Cookies() whichs returns an array of Cookie class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic