Hi,
I am trying to send a mp3 file from my JSP but it is not working well
beacause the "out" is a PrintWriter .
<%@ page import="java.io.*" %><%
response.setContentType("audio/mpeg");
BufferedInputStream is = new BufferedInputStream(new
FileInputStream("song.mp3"));
try {
long size = is.available();
for(int i=0; i < size; i++) {
out.write((char)is.read());
}
is.close();
} catch(Exception e) {}
%>
If I am trying to use OutputStream os = response.getOutputStream() an
exception is thrown:
com.sun.jsp.JspException: Unknown exception:
java.lang.IllegalStateException: Writer is already being used for this
request
at C_0003a.jsp1_0.mp3.index_jsp_19._jspService(Compiled Code)
at com.sun.jsp.runtime.HttpJspBase.service(HttpJspBase.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:78)
at
com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:125)
at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:140)
at com.sun.web.core.Context.handleRequest(Context.java:382)
at com.sun.web.server.ConnectionHandler.run(Compiled Code)
Is it possible to send raw data from JSP ?
Bogdan
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".