• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we preserve the session while navigating to PDF  RSS feed

 
Mahendra Pratap
Ranch Hand
Posts: 42
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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..

 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!