• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling session time out

 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a list of images for a particular item in my database.when i display the details of this item i display the first image from the list along with.
onclicking a link for next image a servlet render next image from session .

i am dacing a problem in handling session .onclicking the link im changing the
image src from a java script but i can't distinguish whether session is available or not .

Can anybody help me on how to handle this ? will dwr help ?

thanks & regards
Anuja Karthikeyan
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am dacing


dacing?

And what does the session have to do with your images?
 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault ,
I am sorry for the spelling mistake i made , i meant "facing" .

Now my images are stored in DB and to reduce db access i kept it in session.
So once the session gets time out image won't be available any more .which results in a blank space in image are in jsp .

Thanks & Regards ,
Anuja K
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the images are called up so seldomly that the session has time to expire, I wonder if caching is really saving you much.

In any case, your caching code sounds like it's not well architected. It should be coded such that code asking for the image doesn't care whether the image is cached or not. The caching code can check the session, and if the image is there, it serves it from the cache. If not, it reads the image into the cache prior to serving.

This not only abstracts the whole process nicely, you no longer need to worry about session expiry since if the session expires, the code is smart enough to reload the image in the new session.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!