Clear the Browser cache while Outputting PDFs

Hi,
I am using Servlet to output a PDF (Streams), i am facing Browser cache problem in IE
since i am setting Content type to PDF as follows...
response.setContentType("application/pdf")
i could not able to use follwoing Clear the Browser Cache
response.setHeader("pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
the above code is not working fine in Netscape but not in IE.
Can any one help me out in this.
Regards
SAM

Hi,
I have a problem with pdf file also, everything working fine in IE and
netscape, but when I tried the streaming of pDF document from my
servlet in response to a request from Opera browser it failed.
the url may give some idea,
http://localhost:8080/pdf/pdfdownload?PDF_FILE=abc.pdf
here pdfdownload is my servlet, and code I used to stream like following
public service(HttpServletRequest req,HttpServletResponse)
ServletContext sc=getServletContext();
String mimeType=sc.getMimeType((String)
req.getParameter("PDF_FILE"));
res.setContentType(mimeType);
File pdf=new File((String)req.getParameter("PDF_FILE"));
res.setContentLength((int)pdf.length());
InputStream in=new FileInputStream(pdf);
OutputStream os=res.getoutputStream();
byte[] buf=new byte[1024];
int count=0;
while(in.available>0)
count=in.read(buf);
os.write(buf,0,count);
the detailed code kept out for simplicity, but the idea is pretty
much is this.
Now, opera opening the stream for a file name pdfdownload and
storing locally and then opening my acrobat reader, the second
time if called it trying to create another file by name
pdfdownload (1)? xxxx where ? is an unknown character, this is
where it's failing, unable to create the file so failing to open
the pdf file. what best process would be to follow in servlet so
the streaming works in all browser, I have seen many link in sun
sites, opening up pdf but it seems they all are stream, and my
opera can identify their size and file name distinctly and saving
them accordingly, any solution ???
thanks
Jishu

Similar Messages

  • Clearing the browser cache....how?

    just loaded Firefox a few days ago...need to clear the browser history. What is the procedure?

    Hi waynesch,
    You should take a look at the Knowledge Base article [[Clear Recent History]]. This process allows you to clear multiple items at once. The article has a video tutorial and should provide you with all of the information you need.
    Hopefully this helps!

  • How do I clear The Browser Cache ?

    I can't find the setting to Clear Browser Cache when I pull down the Safari Setting; how can I clear the cache now?

    Are you running  Safari 6?
    Click Safari in the menu bar and click "About Safari"
    The resulting window will show the Safari verion number.
    The method described in the previous post works with Safari 6.

  • How to invalidate the browser cache?

    Hello,
    at the [AFP Wiki Site|http://wiki.sdn.sap.com/wiki/display/AFP/SAPPortal-AjaxFramework+Page] I found the document "Ajax Framework Page (AFB) - Features and Benefits", where it says
    ! There's no need to manually clear the browser cache when it is automatically
    invalidated
    Browser cache is automatically invalidated when
    The SAP NetWeaver Portal is updated with a new Support Package (SP)
    Content has changed
    User's roles are modified (adding/removing all or parts of roles)
    Does anbody know how to force this invalidation on client or server side? I mean, how does the client side cache know that the roles of a user changed?

    Hi Björn,
    you might know this but just to be sure.
    Backend side: HTTP > invalidate via visual admin, Navigation cache to be invalidated via system administration role, PCD cache  to be invalidated via system administration role
    Client side: to force the browser to pull the new content with IE > CtrlF5, FF > CtrlShift+R. The new HTTP content is pulled even if the server HTTP cache stores old content. In case of F5 the old content from the server HTPS cache will be pulled.
    See you next week!
    Best regards,
    Alex

  • When i try to use hulu acc.i keep getting the same message / sorry we are unable to load the player please check your internet connection clear your browser cache and try again. i thought i did it right .

    Question
    when i try to use hulu acc.i keep getting the same message / sorry we are unable to load the player please check your internet connection clear your browser cache and

    I found a solution! (at least, for my platform; Windows XP Home SP3, Firefox 4.0.1) =) Go to http://labs.adobe.com and download the Release Candidate 1 version of Adobe Flash 10.3.181.5. I swear, the Second I installed this, it worked INSTANTLY xD. Best of luck to you! (and anyone else who sees this =)
    -Erik P.

  • Hulu says I may need to clear my browser cache--how is this done? Any comments appreciated.

    Hulu programs stop and screen message says I may have to clear my browser cache. Does this sound reasonable? How do I do that?

    I don't use Hulu, so I don't know whether clearing your cache will help...
    You can open the Options dialog from the orange Firefox button or the Tools menu:
    Options dialog > Advanced > Network > Offline Storage: "Clear Now"
    ''Or you can use''
    Tools > Clear Recent History
    ''but take care not to clear other history you want to save.''

  • Clearing the Media Cache Database

    Hi,  In a tutorial on using Encore CS6 it says to "clear the media cache database"
    Why is this done?  ...and if done... does it remove any important files, clips, assets..etc that are in my other projects?  Is it safe to do this?
    Thanks 

    PPro and Encore create MANY temporary files, which may be deleted when you are done with the project... your original video clips and project files are in a location of your choosing, not in the cache folders
    Some more on locations http://forums.adobe.com/thread/1007934?tstart=0
    And, one way to design your project http://forums.adobe.com/thread/919388?tstart=0
    I always create my project files on my 2nd hard drive (see below) so the temporary files are also put on that drive
    My 3 hard drives for video editing are configured as...
    1 - 320Gig Boot for Win7 64bit Pro and ALL program installs (2)
    2 - 320Gig data for Win7 paging swap file and video project files
    When I create a project on #2 drive, the various work files follow,
    so my boot drive is not used for the media cache folders and files
    3 - 1Terabyte data for all video files... input & output files (1)
    (1) for faster input/output if you have 4 drives
    - use drive 3 for all source files
    - use drive 4 for all output files
    (2) only 60Gig used, for Win7 & CS5 MC & MS Office & other smaller programs
    Search Microsoft to find out how to redirect your Windows paging swap file
    http://search.microsoft.com/search.aspx?mkt=en-US&setlang=en-US
    I do not use RAID... AVCHD is CPU intensive, not drive intensive like uncompressed, so
    I have no problems editing without RAID (but, this is for "simple" home videos)

  • How do I clear the browsing history on my iPad?

    How do I clear the browsing history on my iPad 2?

    Settings > Safari > Clear History (and Clear Cookies And Data if you want to clear them as well).
    If you also want to clear your search history (i.e. the words/phrases that you've typed in the search box) then you may also need to close Safari completely : from the home screen (i.e. not with Safari 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Safari app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.

  • The Problem about clearing the system cache

    Hi, there!
    I'm trying to draw a lot of image in iPhone programming.
    I used [UIImage imageNamed].
    but it doesn't clear immediately the system cache.
    At last it occurs the out of memory.
    So I thought using imageWithContentsOfFile, but it works very slowly.
    Does anybody know how to clear the system cache?

    Read Position.flx can execute much faster than 5 ms but as it reads a register that is updated every 5 ms on the board, it reads the same value multiple times.
    To get around this problem there are two methods:
    Buffered High-Speed-Capturing (HSC)
    With buffered HSC the board stores a position value in it's onboard buffer each time a trigger occurrs on the axis' trigger input. HSC allows a trigger rate of about 2 kHz. That means, you can store a position value every 500 µs. Please refer to the HSC examples. You may have to look into the buffered breakpoint examples to learn how to use a buffer, as there doesn't seem to be a buffered HSC example available. Please note that you need an external trigger-signal (e. g. from a counter of a DAQ board). Please note that the amount of position data that you can acquire in a single shot is limited to about 16.000 values.
    Buffered position measurement with additional plugin-board
    If you don't have a device that allows you to generate a repetitive trigger signal as required in method 1.), you will have to use an additional board, e. g. a PCI-6601. This board provides four counter/timers. You could either use this board to generate the trigger signal or you could use it to do the position capturing itself. A PCI-6601 (or an M-Series board) provides can run a buffered position acquisition with a rate of several hundred kHz and with virtually no limitation to the amount of data to be stored. You could even route the encoder signals from your 7350 to the PCI-6601 by using an internal RTSI cable (no external wiring required).
    I hope this helps,
    Jochen Klier
    National Instruments

  • I had OS Maverick and downloaded OS X Yosemite and then cleared the mistakenly cleared the hard-drive while trying to re-download OS Maverick and now should I re-download OS X Yosemite in attempts of getting the pictures, videos, and documents back?

    I had OS Maverick and downloaded OS X Yosemite and then cleared the mistakenly cleared the hard-drive while trying to re-download OS Maverick and now should I re-download OS X Yosemite in attempts of getting the pictures, videos, and documents back? 

    No; try using a data recovery product such as the ones listed here. Don't write anything else to the drive until the files are recovered or you choose not to recover them.
    (120682)

  • How do I clear the Disco cache on App Server 9.0.4

    Can anyone tell me how I can clear the Discoverer cache installed on 9.0.4 Oracle App Server? Can it be done using App Server Control, is there command line syntax I can use?
    Thanks
    Andy

    Hi Andy
    I think the only way to get the memory back is to bounce the server. Sorry.
    Best wishes
    Michael

  • How can I clear the DNS cache?

    I haven't been able to connect to my local Library since January.  When I key in the URL, it starts the access routine and then after about 20 minutes, I have to kill it because nothing happens.  I contacted the IT folks at the library and was told that they had made a few changes around the time my problem began so maybe the DNS cache was still pointing at the old info.  He recommended that I enter TERMINAL mode and try to clear the DNS cache, using  "sudo dscacheutil -flushcache" command.   .  I attempted this several times, even changing my applid password, and kept getting invalid responses.

    I did try that and after a few trys it finally worked.  It took quite awhile for the window for the library to finally come up, but it did and I am now able to get in and out with no problems with my library access.  Now when I call up my bank, parts of it don't come up and it kicks me out.  Now, I'll have to search for what fixes that - as it has happened before, so I know it's fixable.  Thanks for you help though.

  • Clear the classloader cache

    Hi all.
    I am trying to clear the classloader cache of the jvm from out my applet.
    (Basicaly like typing x on the java console when a applet runs, but automaticallt)
    Can this be done ? And if , how ?
    Thanks.
    globe_sa

    I don't think so, you'll have to write your own classloader.

  • Clear the page cache

    Hi,
    We have recently started to develop our application on Solaris, before each regression test is run we need to clear the page cache so that performance is consistent. On Redhat/CentOS there is the following command:
    To free pagecache, dentries and inodes:
    echo 3 > /proc/sys/vm/drop_caches
    However I cant find an equivalent command for Solaris. We have been using tail -f /dev/zero to run a huge process until the memory has been flushed which isn't very reliable and slow. Anyone know of a different way to do this?

    If we are running multiple tests one after the other then the first test may make calls which causes information to be cached, then when the second test runs it may make use of the previously used pages in cache. This makes the second test results inconsistent as if it ran first the timing results would be different, also running through a debugger or with truss doesn't give the accuracy for timing that is required in this situation.

  • How to clear the Entity Cache

    I have an Entity based on a GLOBAL temp table. I have a ViewObject based on the Entity. A stored procedure is called from the client that populates the GLOBAL temp table and then calls executeQuery on the ViewObject. The first time the user does this, all rows display fine. When the user changes the selection criteria and clicks a button a 2nd time, the same procedure is called which clears the GLOBAL temp table and repopulates it with the new data. An exception occurs, however, stating that there are too many rows that match the key. The problem seems to be that the Enity has cached the rows from the first execute, but those rows aren't flushed when the 2nd execute is called, which makes sense. It seems that I just need to force the Entity to clear it's cache after my procedure is called, but before the executeQuery is called. I have tried that from the client side by calling clearCache on the view AND clearEntityCache on the transaction, but they don't seem to do anything. I have also called clear cache on the app module side in the method that calls the stored procedure, but it doesn't seem to do anything either. I also turned on the JBO debugging messages and I can't see any message stating that the Entity or View cache was cleared. It appears that these calls do nothing.
    Is there a way to work around this to make the Entity/View chaches completely refresh from the database?
    Thanks
    Erik

    Typically the client layer never has access to entities. This API is the one exception. The way to keep it cleaner would be to create a custom Application Module method, and inside that perform the clear cache, rather than burdening the client to have to know about any details of underlying entity objects. Keep that hidden.
    I wouldn't think you should need to clear the entity cache to do what you're doing, though. If you have a reproducible test case -- with SQL script that creates your example global tempory table -- if you could create a TAR on Metalink and ask support to file a bug for it, that would be great so we can look into it.

Maybe you are looking for

  • Making a selection from a Choice Field and having Another Set of Selctions Avaiable to Select in a Form

    Hello, I am creating and food menu form and some of the selections have a 'combo' option.  I have created a Choice field Column with the menu items available and when say Veggie Melt is selected I'd like to have it then display the combo options for

  • Unable to create a layer

    I am using CS5 which I have just bought. When I try to use layers I can open my first photo as the background which is fine. I then open a new layer, and my second photo. However instead of opening as a new layer it defaults as the background, replac

  • Credit management for Old sales orders

    Hi experts, pls consider the follwing example where i am facing some problem. I activated the Credit lock system in Sales order level (Warning message with release strategy)and in PGI. (Warning message with release strategy). Customer A C.limit : 100

  • Email link will not open on desktop computer

    Hello. I am wanting to know why I can open email links from Shopify on my tablet and cell phone but not on my Desktop computer.  Thank you in advance for your help with this.

  • Need basic software protection

    Hi all, I have written an application, and I need some soft of not-to-fancy-and-complicated way to ensure that it won't be distributed w/o my consent. I was thinking of having some kind of hard-coded serial number, but what assures me that people won