How can I generate bynary content (say, a serialized java object) from a
JSP 1.0 page??
In previous JSP versions it was possible to write directly to the
response output stream and my code worked.
With JSP 1.0 this seems to be not possible, in fact the following code
<%@ page contentType="application/octet-stream" buffer="none" %>
<%
response.setHeader("Content-transfer-encoding", "BINARY");
MyObj x = new MyObj();
ServletOutputStream outStream = response.getOutputStream();
ObjectOutputStream objStream = new ObjectOutputStream(outStream);
objStream.writeObject(x);
objStream.close();
%>
generates the error java.lang.IllegalStateException: Already called
getWriter() (JRun 2.3.2 build 152).
The error seems to be OK because 1) according the JSP1.0 spec the JSP
engine have to initially set the out variable to an instance of the
JspWriter (obtained by PageContext.getOut() which in turn probably calls
response.getWriter() and 2) according to Servlet API it is not possible
to call the getOutputStream() method after having called the getWriter()
method of the response object.
So, how can I do? Please...HELP!
Iacopo
P.S.
If I allow buffering then the binary output is correctly generated but
at the end of the page the error message
java.lang.IllegalStateException: Already calledgetOutputStream() is
appended (probably generated by the out.flush() call which calls
getWriter() ?)
===========================================================================
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".