cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Engelhart <mengelh...@earthtrip.com>
Subject Re: Redirecting users in Cocoon
Date Tue, 01 Feb 2000 20:22:51 GMT
Donald Ball wrote:

> Hmm, I was just poking through the code and I fail to see where cocoon
> grabs the outputstream anywhere before this section:
> 
> response.setContentType(page.getContentType());
> 
> // get the output writer
> PrintWriter out = response.getWriter();
> 
> // send the page
> out.println(page.getContent());
> 
> unless an exception occurs, in which case Frontend steps in to nicely
> format the stacktrace. it should be a simple matter to check the response
> object at this point and see if a redirect has been sent, and if so, not
> to print anything. Right? If so, +1 for you to send in a patch to
> accomodate that behavior.
> 
> - donald

I'm not sure where it's happening either but try out this little XSP
snippet:

<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
    <DOCUMENT>
        <xsp:logic>
            session = request.getSession(true);
            RequestDispatcher rd =
request.getRequestDispatcher("/test.html");
            System.out.println("RequestDispatcher = " + rd);
            rd.forward(request, response);
        </xsp:logic>
    </DOCUMENT>
</xsp:page>


This gives me an IllegalStateException (even though the request does get
forwarded):

java.lang.IllegalStateException: OutputStream is already being used for this
request
    at org.apache.tomcat.core.ResponseImpl.getWriter(ResponseImpl.java:212)
    at 
org.apache.tomcat.core.HttpServletResponseFacade.getWriter(HttpServletRespon
seFacade.java:150)
    at org.apache.cocoon.Frontend.print(Frontend.java:96)
    at org.apache.cocoon.Frontend.error(Frontend.java:91)
    at org.apache.cocoon.Cocoon.service(Cocoon.java:154)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
    at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:224)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:347)
    at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:144)
    at 
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:305)
    at java.lang.Thread.run(Thread.java)


What's confusing me is that a cursory look at the Cocoon source doesn't seem
to show where it grabs the output stream that would cause the above
exception.  I know Frontend.java uses it for errors and status but other
than that the only place that the output stream is used is after the
processing of the request.  Does anyone know what's going on??? Stefano?

Mike

Mike


Mime
View raw message