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 download bytes 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 "download bytes" Watch "download bytes" New topic
Author

download bytes

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 102

Hello;

I would like that the browser (firefox) whre able download the zip file from my servlet ( byte array).

I tried the following

... but it doesn't works.

Thanks.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Just saying that It Doesnt Work Is Useless. Tell us more details about what is happening...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Use ServletOutputStream when you writes write byte data and close the stream after finishing.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Fernando Dominguez wrote:I would like that the browser (firefox) whre able download the zip file from my servlet ( byte array).
I tried the following


Hi Fernando,

When you are writing raw bytes you should use ServletOutputStream instead of PrintWriter and write the bytes to the stream (that's just pure Java).


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: download bytes
 
Similar Threads
zip files without path info...
ZipException - invalid entry compressed size
Convert OutputStream to byte[]
Test Installation
problems in downloading epub files