Problem with writing bytes with OutputStream
Hi guys
I'm reading an audio file from the database and writing it to the response object via a servlet and playing it in the browser using the embed tag.
It works well with Internet Explorer but with Mozilla - i get the following error.
ClientAbortException: java.net.SocketException: Connection reset by peer: socket write Error
And the file does not play.
This is how my java code is:
Blob b = rs.getBlob("BINARYFILE");
byte[] ba = b.getBytes(1, (int)b.length());
OutputStream os = response.getOutputStream();
response.setContentType("application/x-mplayer2" );
os.write(ba);
os.close();
I'm sure nothing is wrong in the code as it works well in Internet Explorer. But in Mozilla it throws the above error.
This is how i'm using the Embed tag in JSP : Connection is the Servlet that writes the binary data to the response
<EMBED SRC="http://localhost/music/Connection?id=99837425"type="application/x-mplayer2" [code]
autostart="true" >
</EMBED>
[/code]
Any help would be appreciated
thanks
gublooo

