• 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

Session for static pages

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the book it is given that URLRewriting won't work with staic pages,coz there is no way for dynamically generating sessionId..So session fails if cookies are not enabled,static pages are being used......Just wanted to make sure,session wont fail for static pages if cookies are enabled right?

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

Just wanted to make sure,session wont fail for static pages if cookies are enabled right?



From the explaination in the book I understood that URL rewriting is not possible for static pages. Cookies require URL rewriting as a starting point, for the server to know that Client accepts cookies. So, I dont think we could have sessions for static pages even when cookies are enabled.

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

Originally posted by Chandra Sagi:


Cookies require URL rewriting as a starting point, for the server to know that Client accepts cookies.



I thought cookies and URL rewriting are 2 independent things.Container uses either cokies r URL rewriting as a means to exchange sessionId between itself and the client....The only way for server to know that client doesn't accept cookies is,when it doesn't find value for Cookie in request,then it switches to URL rewriting..

Originally posted by Chandra Sagi:


So, I dont think we could have sessions for static pages even when cookies are enabled.



I think if cookies are enabled,container uses cookies as means to exchange sessionId.So we should be able to use session for static pages.

Please correct me if I understood wrong.

Thanks
Veena
 
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
A better explaination on your questions is in pg's 236 and 237 of HFSJ. It should be clear reading that, else you can get back anytime.

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,

I think if cookies are enabled,container uses cookies as means to exchange sessionId.So we should be able to use session for static pages.



The session is between user and application. The session is valid for the user once created in the application. So when the static page is encounter from the user from the current session, the session is still valid for the user, but you can not use the session in static page anyway, because the page is static and there is no dynamic content.

In case of session, generally the containers checks for the cookies first. If cookies are disabled then only it URL rewiting. So when the static page is encountered, as there no way to generate the dynamic sessionID. We can not use it in static page.

Hope it helps

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
Thanks all for replieng.Now I understand.Sessions can not be used for static pages irrespective of weather cookies or URL rewriting is used for session.Realized the following just now.

<b>Because when Cookies are used getSession is the method that is responsible for creating JSESSIONID and setting it as cookie in response header.This we can not include in static HTML page.</b>

Somebody correct me if I am wrong.

Thanks
Veena
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic