An exception occurs while i try to view a mpeg file by using servlets.the mpeg file resides on the server.i used res.setContentType("video/mpeg"),got an Inputstream from ServletContext, got an outputstream and wrote the bytes.
but got the Exception while downloading the file at the client. ClientAbortException;java.net.SocketException,Connection reset by peer. socket write exception at line .....
the line is sos.write(bytes,0,data);
i changed the contentType as setContentType("video/quicktime"),but the file couldn't be recognized at the client.it shows blank at filetype so the user has to choose from the type of program to open the file.
i want the foll. scenario.
when the page is submitted ,the file gets downloaded automatically and can be view in the browser itself.(or the concerned the media player )
I have not worked on this mpeg file format. But the way to do it is that...by changing the format of the servlet content type...whenever that servlet is called, it will return a file with that format. But if you want to play in the browser, then you need to call the plugin for that i.e. you need to make an html page in which there will be a plugin for running that file and it will be displayed in the browser.
You can do it without using streams, that will be an easier method.