This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to attach/Detach cookies?

 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to invoke a website(login/logout) and attach/detach cookies using java....I'll appreciate any help possible´┐Ż..
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can add and get cookie using HttpServletResponse, HttpServletRequest

In JSP,

1. you can add cookie using response implicit object.



2. you detach cookie by setting maxAge(maximum time).


3. you can get the added cookie using request implicit objects.

Cookie[] cookie = request.getKookies();

4. you can replace cookie with using key with different value (which will replace cookie with new value).

hth,
 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thans Prabhu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic