• 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
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Can we preserve the session while navigating to PDF

 
Ranch Hand
Posts: 42
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a scenario where i am opening a PDF file on click of a link which opens in new window. PDF is dynamically created depending on the link. and on that PDF i have few buttons. On click of these buttons, it opens a new page which navigates to a jsf page but the session is not getting becoming invalid. What should i do? if any of you having any idea then please guide me to solve this.

I hope you all got my problem, if not then please ask me to elaborate more.

Thanks,
Mahendra
 
Mahendra Pratap
Ranch Hand
Posts: 42
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried appending session Id to the URL but then also i am getting the Logout page..



This is how i used URL rewriting where jsessionId is session Id from JSF managed bean and abcId is some other parameter i am passing..

 
Saloon Keeper
Posts: 28399
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These days, session IDs are mostly passed in cookies, but occasionally you'll have someone who refuses cookies, so a truly robust webapp will also support URL rewriting.

However, the cookie is attached to the browser, so unless your system is set up to launch a different web browser when you click in a PDF, I don't think it should be losing the session on that account.

A more serious problem is that PDF's have an indefinite lifespan, but sessions are normally quite limited. So if I print a PDF today and click on the link tomorrow, that's simply not going to work. The session will almost certainly have been destroyed.

Which is just as well, since if the application is a secure one, you'd have a major security issue if someone could just click and go right in.

Rather that attempting to put a session ID in the PDF, you should look at putting some sort of information that can be used to reconstruct whatever session context you need when the link/button is clicked.
 
Mahendra Pratap
Ranch Hand
Posts: 42
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply Tim.

yes system is launching different browser on click on PDF.


Rather that attempting to put a session ID in the PDF, you should look at putting some sort of information that can be used to reconstruct whatever session context you need when the link/button is clicked.


the session context i want to preserve is user details as the user is logged in and i don't want the system to ask user for logging again. do you have any idea how can we achieve this?
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic