• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cookies

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hfsj says that cookies can contain name/value string pairs...example whenever i start my gmail page it already contains my name and password...but what does

But you can tell a cookie to stay alive even after the browser shuts down

mean?

i thought cookie is associated with a session and session ends with the shut down of the browser..can anyone clarify
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cookies and sessions are a different thing. JavaEE uses Cookies to identify clients associated with a particular session (this is just one of the ways to identify a client's session). You can create cookies on the client machine independently of the session. There's no need for a session to be present for sending a cookie with a response...
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur Jain Kothari wrote:hfsj says that cookies can contain name/value string pairs...example whenever i start my gmail page it already contains my name and password...but what does

But you can tell a cookie to stay alive even after the browser shuts down

mean?

i thought cookie is associated with a session and session ends with the shut down of the browser..can anyone clarify



Session uses cookies to make stateful conversation. AM I right? ??

Since webcontainers are stateless, cookies are used. Now when browser is shut down or the session ends, the cookie can still sruvive. I think in web.xml you can say for how long you can keep the cookie to stay alive. I am reading right now in the book that it can also be done programetically.. but I have not tried that yet.

Anyhow, yes cookie can stay alive long after your browser is not there. However, a session can be there without cookie. Imagine a situation where the client has deliberately disabled cookie. What happens then? I think you can then use sessionID appened to browser URL ....Am I right? Actually the webconatiner does this for you? However, you have to say it somewhere...umm still studying that....

That is my knowledge so far about this. Hope this helps somehow
 
Ankur Jain Kothari
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the age of the cookie can be altered programmatically and not in the web.xml file. Only the age of session can be done both ways.

I think in web.xml you can say for how long you can keep the cookie to stay alive.

 
Oprah Thaddeus
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur Jain Kothari wrote:the age of the cookie can be altered programmatically and not in the web.xml file. Only the age of session can be done both ways.

I think in web.xml you can say for how long you can keep the cookie to stay alive.



oh yes thanks :-)
reply
    Bookmark Topic Watch Topic
  • New Topic