Jari,

thanks for looking at my problem.

I have looked at the servlet API and it doesn't really help me
identify a clear offender in my code.

I don't set the "type" more than once in my responses, at least
I don't think that I do...

I will show you the flow of events that lead up to the problem:

1. JSP page renders to a browser. The resulting HTML page
   contains links that point to another JSP page in the
   following manner:
           <a href="test2.jsp?objectID=123">Attachment one</a>

2. The user clicks on one of the links to initiate the download
   process.

3. The "test2.jsp" page takes the passed object ID and pulls
   the EJB object out of the database and puts the object in
   the user's session. After this is done in the "test2.jsp"
   page it sends a redirect, response.sendRedirect(), to my
   servlet.

4. The servlet actually performs the getOutputStream() command,
   and streams the binary content of the object to the browser.
   I am under the impression that since I did a
   response.sendRedirect() in step 3, that step 4 is dealing
   with a completely new response.

5. The download actually works, but the hourglass keeps twirling
   in my original window, leading me to the conclusion that something
   went awry. Additionally, there is no error generated by my compiled
   JSP servlet leading me to believe that the JSP engine, JRun in my
   case, is calling a getOutputStream() or a getWriter() outside of my
   compiled JSP page, and after my servlet has executed...

6. Finally, the compiled JSP page does perform a
               JspWriter out = pageContext.getOut();
   but that shouldn't cause any problems.

Thank you for taking the time to look at this, I look forward to
hearing from you again.

Cor Ruiten


-----Original Message-----
From: Jari Worsley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 01, 2000 2:03 AM
To: Cor Ruiten
Subject: Re: Problem downloading binaries (JSP to Servlet to Browser)


Cor,
have you checked the servlet documentation for a lead on this?

I had this problem writing servlets - basically you can only call
getOutputStream and set it's "type" once - if it gets set to "text/html"
before you want to write binary data to it, then you're screwed (to use
the technical term ;)

Have a look in the servlet api at the getOutputStream call, then try
looking at any generated java code for your jsp pages.

Jari

>
> Mon Feb 28 17:24:59 PST 2000: Running servlet
> { (Running servlet) java.lang.IllegalStateException: Already called
> getOutputStream()
>         at

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to