aspose file tools*
The moose likes Servlets and the fly likes Download servlet creates aditional files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Download servlet creates aditional files" Watch "Download servlet creates aditional files" New topic
Author

Download servlet creates aditional files

Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Hi, it's me again

So i have file download servlet with doGet() as below, and everytime client downloads file, a copy of this file is saved on dekstop of my server PC. I have no idea why, the path to the desktop isn't even used in my whole application... So what's causing that strange behaviour?

Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Any idea?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Are you sure it's not the browser which is doing that? Which browser do you use? See if there's some setting in there which is storing it to Desktop.

[My Blog] [JavaRanch Journal]
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

It's on all popular browsers. And I don't think if it's possible that browser on client's computer saves files on server's computer. So it must be something wrong with server-side code...
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

hi Karol,

I run this code and for me its not creating any unnecessary file on desktop. It works fine and ask user to download the file.


Regards
Jatan
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Karol Wojcik wrote:And I don't think if it's possible that browser on client's computer saves files on server's computer. So it must be something wrong with server-side code...

Oh, so you mean the file gets created on the server's desktop. That definitely has to be some server side code which would be doing that. Are you sure someplace in your code you don't dump out that contents (maybe for testing) to the filesystem?


I have no idea why, the path to the desktop isn't even used in my whole application


Have you checked the code for places where it might be calling System.getProperty("user.XXX") where XXX is some specific property like user.home and then using that info to dump the file?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Actually this code doesn't look right:



Why are you creating a copy of the file which already exists and writing it to the server's filesystem? And yes, this can be the issue you are running into since:



can end up pointing to the desktop.
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Well i know that it looks kind a strange but it's a solution i found in order to fix downloading issues caused only by IE8, and somehow it works... (here is a source)
But actually it seems that it's not the download servlet that cause the problem... i turned off the download option, and files are still created at dekstop...
I'm investigating my file generator's code.
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Karol Wojcik wrote:Well i know that it looks kind a strange but it's a solution i found in order to fix downloading issues caused only by IE8, and somehow it works... (here is a source)
But actually it seems that it's not the download servlet that cause the problem... i turned off the download option, and files are still created at dekstop...
I'm investigating my file generator's code.


edit:
well, there is nothing to go wrong while generating file, so still... I have no idea

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Karol Wojcik wrote:Well i know that it looks kind a strange but it's a solution i found in order to fix downloading issues caused only by IE8, and somehow it works... (here is a source)

That doesn't look right. There's no need to create a copy of a file on the server when the file is already present of the server. What exact issue are you running into if that code isn't used with IE8?
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

it's a common issue with servlet's name given instead of downloaded file name.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Karol Wojcik wrote:it's a common issue with servlet's name given instead of downloaded file name.

Maybe point us to a link which explains the issue? The blog that you pointed to doesn't say what the real issue is, for which that solution/code is provided. And I haven't seen or heard of having to duplicate a file on the server just to let it be downloaded.
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Actually i faced two issues:
the one i solved just by changing IE safety settings
and second one described here

But I was searching for solution for both of them at once, and that's how my doGet() was created...
Karol Wojcik
Greenhorn

Joined: Apr 19, 2012
Posts: 17

Jaikiran, it appears You where right I've deleted this "double file caching" and everything is ok, file names are correct, user is asked where to save the file and there are no more unnecesary files on desktop. Thank You
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

Good to know
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Download servlet creates aditional files
 
Similar Threads
video playing/streaming
Problem in downloading file from server using Http Response
file download servlet does not work on IE8
Please help with response.getoutputStream
.pptx and .docx problem