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
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
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
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