Set the content type.
Set the content disposition.
Get a servletOutputStream from the response object.
Write the bytes to the outputStream.
Flush the stream.
Sort of like this...
You'll need to add exception handling and probably buffering if you're
streaming the byte array in and out at the same time.
There are lots of examples on the web for doing that.
This should get you started.
response.setContentType("application/vnd.ms-word");
response.setHeader(
"Content-Disposition", "attachment; filename=myFile.doc");
ServletOutputStream out = response.getOutputStream();
for(int i = 0; i < byteArray.length; i++){
out.write(byteArray[i]);
}
out.flush();
On Thu, 2004-10-28 at 21:11, Daxin Zuo wrote:
> I receive a byte array from a remote server, and the servlet will display it
> on the browser. The byte array contains a MS DOC file. If I simply convert
> it to a String, the contents will be meaningless.
> Please forward instruction.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]