• 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

Storing Objects URGENT

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the best possible way of storing objects,
in session or in cookies.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Best way to store objects is a HttpSession and not cookies as cookies reside on client computers and not trusted also they dont work when disabled.
HIH
Cheers
Vishal
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also there is a size limit on cookies and for anything besides String objects you would have to encode the object somehow.

Why do some people think that marking a post as "URGENT" will get them any more attention than a more informative title? I'm really curious about this.
Bill
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Why do some people think that marking a post as "URGENT" will get them any more attention than a more informative title? I'm really curious about this.


Good question Bill . Also you might want to change your name to match the one and only rule and it can be found in JavaRanches naming policy. If you store objects in Cookies (which I don't recommend) I believe they can only be of size 32K. Store them in the HttpSession..
Cheers,
Ryan
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ryan .
OK - now to make it official
k1ndkam,
Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.
Thanks,
Cindy
 
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you need to store objects across sessions or applications, you can store them in servletContext.
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Say that again,
If u store anything in the session and servlet context, its the same thing. I do not think so. All the objects that are stored in the servlet context will be available to the resources in that servlet context and not to resources outside that while as the session variable will be available to all the applications irrespective of their servlet contexts.
Is that right.
???
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Briefly - NO!
Sessions are only shared within a "web application" which equates to a servlet context.
The servlet API originally had some methods that were more liberal but they got removed due to security concerns.
The original post was not clear on the scope that the objects were to be visible in. You have several choices, the whole application with ServletContext, the user's session with HttpSession and the individual request with objects attached to the ServletRequest and probably some more I have not thought of
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic