• 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 exist when we close browser?

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does cookies exist when we close browser and open other one?How about session? As per my understanding, Container considers requests from 2 browsers as 2 different clients.It has no way of figuring out 2 browsers are n same machine or difft? so if you close browser and open the same request in new browser,to the container it is different request,so it creartes new session,new cookies....?

How can we make cookies to exist even when we close browser?

Thanks
Veena
[ March 07, 2006: Message edited by: Veena Point ]
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How can we make cookies to exist even when we close browser?



Cookies could be given a lifetime when we declare them. We could use cookie.setMaxAge(int) where is in seconds. when we set it to -1 the cookie disappears when we close the browser. A zero value causes the cookie to be deleted.

And about your question when the same cookie could be used by two browsers at same time from the same machine is YES. The cookies are stored in a particular location in your computer and with the name of the URL generally. When you open an URL it first looks whether there is any cookie associated with the particular URL and sends it with the request. You can even come after sometime and see that the cookie is still alive.

A browser is expected to support 20 cookies for each webserver, 300 cookies total and may limit the size to 4kb each.

Hope this helps.

Thanks
Chandu
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replieng.By default what value of max age is set for cookie.And was curious what location we can look into on our hard disk to see cookies and their values?
 
Chandra Sagi
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure about the default value. I guess it would be -1, to delete the cookie as soon as we exit out of the browser. As I told you before we can use the same cookie from two browsers, so is the reason when you signout of any credit card website they ask you to close all your browsers to the site for security. By doing so you would invalidate all the cookies from the website.

You could find cookies in your cookie folder in C:\Documents and Settings\"your computer name"\cookies

Thanks
Chandu
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Container considers requests from 2 browsers as 2 different clients.It has no way of figuring out 2 browsers are n same machine or difft?



It is not true. It is absoultely brower dependent. Try it on IE, it treate 2 open windows differently. But in case of Firefox it treat as session from one breower for two windows.

Thanks
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Narendra Dhande:
Hi,



It is not true. It is absoultely brower dependent. Try it on IE, it treate 2 open windows differently. But in case of Firefox it treat as session from one breower for two windows.

Thanks



But theoratically Container can not differentiate 2 browser requests ,right.May be cookies are not enabled in IE and are enabled in FireFox?
 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you need to know that there are 2 kind of cookies :
session cookies and permanent cookies

http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/cookie_support.html

Session cookie :
a cookie that is erased when the user closes the Web browser.

Permanent cookie :
a cookie that is stored on a user�s hard drive until it expires or until the user deletes the cookie
 
Veena Pointi
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This clears everything.Thanks Max.
 
Chandra Sagi
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Narendra,

It is not true. It is absoultely brower dependent. Try it on IE, it treate 2 open windows differently. But in case of Firefox it treat as session from one breower for two windows.



I came across accessing a session from two windows of IE and it says

What constitutes a �new browser session�? Here�s an observation on Internet
Explorer�s behavior. If you launch Internet Explorer afresh, then access a session-
aware servlet�that�s a new session. If Internet Explorer itself launches a
new Internet Explorer window (e.g., by running File | New Window or by running
some appropriate script) and that new window accesses a session-aware
servlet�it shares the session object with the Internet Explorer window from
which it was launched. This makes reasonable sense, and it�s probably not the
only browser that exhibits this behavior.



Source: SCWCD Study guide - Osborne

It might be browser dependent also.

Thanks
Chandu
 
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic