aspose file tools*
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 Spring in Action this week in the Spring 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: 104

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: 9305
    
  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: 3838

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