This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes outputStream gives wrong file name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "outputStream gives wrong file name" Watch "outputStream gives wrong file name" New topic
Author

outputStream gives wrong file name

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
i am trying to send a jar file to the client.
here is the code for it.but it change the file name and there is no any file type.
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
What error you are getting exactly?

Does the test.jar exist within files folder?
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
not actually a error.
it save file named in the name of the servlet class name and without any file types(this file name is copy)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

I don't know of any direct way of doing what you are asking for. Once I needed a similar thing, i.e. I needed a servlet to deliver dynamic excel files. So I mapped the servlet to a path like /excel/*, and then sent request to it with the URL /excel/Accounts.xls and then the servlet used to create the excel and send it to the client and is used to save with the name Accounts.xls...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Check out the use of the content-disposition header.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: outputStream gives wrong file name
 
Similar Threads
read and write file in parts
how to pass multiple BLOB objects to a PLSQL procedure?
Reading image and convert it to Base64 format
File upload
writing a file from a byte array