• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Cookies

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i use a cookie.. will it be different from the cookie that the container creates???

Because, as per my understanding.... the container cookie (say with jsessionId) must expires with the session. And the session Id will be different for each session.

Whereas, my application needs to preserve some data even after the session expires. So is it always that they will be different or only in particular instances whereever necessary.


Also, how do i set the cookie to never expire, beacuse -1 will make it expire as soon as the session times out??
[ May 22, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Browsers usually hold session cookies in memory.
They never get written to disk.
Users can configure their browsers to treat all cookies that way so you can never fully rely on the behaviour of your user's browsers when it comes to them.

You can set the expiration date on a cookie.
Since the average PC doesn't last more than 5 or so years, setting the expiration date for now + 10 years should get you the results you want.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

They never get written to disk.
Users can configure their browsers to treat all cookies that way



How is this configured?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each browser has a different place for configuring cookies.
I'm not sure which one has the "treat all cookies as session cookies" option.

You would have to read the help section for each browser that you intend to support.
 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

"treat all cookies as session cookies"



Should it be browser specific??
I meant was there a way to program to make cookies,not be written to the hard drive, because the same browser might be used to access different applications, and the one application may need it to be written to the disk and other would not want it.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't control, from a server based app, how a user configures his/her browser. Different browsers offer different options as far as dealing with cookies, popups, javascript, css, etc...

When you, the developer, start a project, you have to determine what your target audience is and then decide what technologies you want to use.
In a tightly controlled intranet where company policy dictates what OS and browser will be used, you're able to rely on a lot of browser specific features and configuration.

With a public site on the internet, you will either need to make your site a s simple as possible with the least amout of reliance on such things (Amazon, Google, and like do this) or you need to accept that a percentage of people who run across your site will not be able to use all the features you've written.
 
reply
    Bookmark Topic Watch Topic
  • New Topic