aspose file tools*
The moose likes Servlets and the fly likes Removing temp files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Removing temp files" Watch "Removing temp files" New topic
Author

Removing temp files

muneer ahammad
Greenhorn

Joined: Feb 26, 2008
Posts: 2
Hi,
I am facing problem in removing the temp files (PDF) which i m creating threw servlet using iText. once the pdf is created and its saving in the temp internet folder.how do i prevent/delete storing the created pdf?

Kindly help in solving this issue.

Regards,
Muneer.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Do you mean that iText is creating files on the server or are you talking about the copy that gets saved to the client's temp folder when they open the PDF?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
muneer ahammad
Greenhorn

Joined: Feb 26, 2008
Posts: 2
i means to say that it gets saved to the client's temp folder when they open the PDF
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

That's something you (the web developer) have no control over.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Generally you can instruct a browser to do not cache content file. It is really big security risk to have the file kept in the directory. Did you try to

?


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Originally posted by D Rog:
Generally you can instruct a browser to do not cache content file
Caching and downloading are two very different things. The cache control headrers have no effect on how long temp files are kept.

The file must be stored on the client system in order for it to be opened. There is no way to make it go away after any certain period of time.
[ February 29, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

It is just yours understanding the problem. For example Adobe reader gets just URL and manage downloading itself. So no temporary file is created at all. So you are just kindly not right.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by D Rog:
For example Adobe reader gets just URL and manage downloading itself. So no temporary file is created at all.



That's not what I see when I watch the network traffic with a packet sniffer.
I put a PDF up on my server http://www.souther.us/nissan_manual.pdf.
Then I created an HTML page with a link to that PDF http://www.souther.us/getPdf.html and watched the network traffic with tcpflow while clicking on the link


tcpflow -c port 80
tcpflow[3294]: listening on eth0
192.168.001.002.34369-069.059.022.027.00080: GET /nissan_manual.pdf HTTP/1.1
Host: www.souther.us
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.souther.us/getPdf.html
Cookie: JSESSIONID=AFAB73FBE382925690CD5DDBBA05CAE6


069.059.022.027.00080-192.168.001.002.34369: HTTP/1.1 200 OK
Date: Sun, 02 Mar 2008 03:45:11 GMT
Server: Apache/1.3.37 (Unix) mod_jk/1.2.20 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b
Last-Modified: Sun, 02 Mar 2008 03:40:40 GMT
ETag: "58066b-eec1c-47ca21b8"
Accept-Ranges: bytes
Content-Length: 977948
Connection: close
Content-Type: application/pdf


Notice that the user agent (in bold) is Mozilla / FireFox, not Adobe Acrobat.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Removing temp files