• 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
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Expiring a pdf document in the browser

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have created a pdf in my servlet using iText and my
servlet response goes to the browser, netscapte 6.2
after rendering pdf I move to different url .. and
when I try to use browser BACK button I don't want to
see the pdf on my browser ,..in short I want to expire
the pdf ...
kindly let me know how to do this ..
Your help is highly appreciated
Ram
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not open the pdf doc in a new window?
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Swaroop! I have to have the pdf in the same HTML page in a different frame.
thanks
ram
 
Sheriff
Posts: 67558
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you send the PDF data stream to the response you can simply expire the page in the same manner as any other page. Doing so for JSPs has been discussed many times in these formus. Do a search and you'll find examples of the relevant code.
Btw, I may be doing something similar in the very near future. Perhaps you can post your opinions of using iText to generate PDF in the Other Java APIs forum. Many of us may find it useful.
thanks,
bear
 
ram ragu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK! I will put a short note about using iText in Other JAVA API shortly... it is wonderful API for creating PDF and it works fine.. also has a useful discussion forum.
Comming back to my issue.....

Yes I did try to give the following in my servlet response
response.setHeader("Cache-Control","no-store"); FOR http 1.1
response.setHeader("Pragma","no-cache"); for HTTP 1.0
response.setDateHeader("Expires", 0);
even after setting up the above header's ..still my browser keeps the pdf in the cache.. when i use BACK button browser shows me the pdf.... then I tried to set the size of DISK cache in Netscape 6.2 to 0kb.. still browser shows the pdf but this time it made a request to my servlet ..created pdf
but i don't want the browser show the pdf when BACK button is pressed..as of now i don't have an idea..
Kindly let me know if there is a workaround for the problem
thanks
Ram
 
swaroop shastri
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would not work coz the browser makes a request to the server when the user hits the back button(because you have set the no-cache header)
Let me describe the problem as i have understood it.
servlet1 -> page1.htm
servlet2 -> doc.pdf
page1.html has the hooks in place to make a call to servlet2 to stream the pdf.
What i would suggest is, incorporate logic in the servlet that streams the pdf, to only stream it if the the referer is "servlet1" else let it redirect to servlet1. Hope this might help.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic