• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to write Binary Data

 
Gilbert johnson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



And the file does not play.

This is how my java code is:



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



And one more thing. I have all the plugins installed to play the file in mozilla. Cos if I use the Embed tag and specify the location of the audio file on disk - it plays it well in mozilla also. Like


This works in mozilla and the file is played.

So i know there is some problem in the code or something. Cos the above error does not appear when i use Internet explorer - only in mozilla


Any help would be appreciated
thanks
gublooo
[ April 23, 2006: Message edited by: Bear Bibeault ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to set the Content-length header, for one thing.
 
Gilbert johnson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

Yes I am already setting the content length. Is there any other header that I need to set for Mozilla. This is the entire stack trace that I see when I access the site on Mozilla but not on IE.

ClientAbortException: java.net.SocketException: Connection reset by peer: socke
t write error
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:328)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:392)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:76)
at java.io.BufferedOutputStream.write(Unknown Source)
at com.world.servlet.MusicConnectionServlet.streamBinaryData1(MusicConnectionServlet.java:127)
at com.world.servlet.MusicConnectionServlet.doGet(MusicConnectionServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic