Ops, sorry sent this to the wrong mailing list. Please ignore it, posting to
myfaces list now..

On 30/06/06, Mikael Andersson <[EMAIL PROTECTED]> wrote:

Hi,
I am running into some problems when trying to stream files back to the
browser via a simple custom component. The problem is that I get OutOfMemory
exceptions when the files grow large in size.

The code in the renderer is really simple:

        BufferedReader buffReader = new BufferedReader( reader );
        String line = null;
        while( (line = buffReader.readLine()) != null ){

            if( isHighlight() )
                line = highlight(line);

            writer.write(line);
            writer.flush();
        }
    }

A guy at the office who knows a lot about JSF told me that the
ResponseWriter writes the data into memory and then renders all the content
of the response in one go. Is there some way of by passing this and really
stream the content?


The stack trace I get:

WARN:  EXCEPTION
javax.servlet.ServletException: java.lang.OutOfMemoryError: Java heap
space
       at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
PageContextImpl.java:848)
       at org.apache.jasper.runtime.PageContextImpl.handlePageException(
PageContextImpl.java:781)
       at org.apache.jsp.catfile_jsp._jspService(
org.apache.jsp.catfile_jsp:111)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
       at org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:322)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(
JspServlet.java:291)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
       at org.mortbay.jetty.servlet.ServletHolder.handle(
ServletHolder.java:423)
       at org.mortbay.jetty.servlet.ServletHandler.handle(
ServletHandler.java:355)
       at org.mortbay.jetty.servlet.SessionHandler.handle(
SessionHandler.java:226)
       at org.mortbay.jetty.handler.ContextHandler.handle(
ContextHandler.java:567)
       at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:263)

       at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:125)

       at
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(
ServletExternalContextImpl.java:416)
       at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView
(JspViewHandlerImpl.java:234)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(
LifecycleImpl.java:384)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
       at org.mortbay.jetty.servlet.ServletHolder.handle(
ServletHolder.java:423)
       at org.mortbay.jetty.servlet.ServletHandler.handle(
ServletHandler.java:355)
       at org.mortbay.jetty.servlet.SessionHandler.handle(
SessionHandler.java:226)
       at org.mortbay.jetty.handler.ContextHandler.handle(
ContextHandler.java:567)
       at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
ContextHandlerCollection.java:147)
       at org.mortbay.jetty.handler.HandlerCollection.handle(
HandlerCollection.java:126)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(
HandlerWrapper.java:119)
       at org.mortbay.jetty.Server.handle(Server.java:248)
       at org.mortbay.jetty.HttpConnection.handlerRequest(
HttpConnection.java:381)
       at org.mortbay.jetty.HttpConnection$RequestHandler.content(
HttpConnection.java:651)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:611)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:197)

       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:310)

       at
org.mortbay.jetty.nio.SelectChannelConnector$HttpChannelEndPoint.run(
SelectChannelConnector.java:807)
       at org.mortbay.thread.BoundedThreadPool$PoolThread.run(
BoundedThreadPool.java:475)
Caused by: java.lang.OutOfMemoryError: Java heap space


Help would be really appreciated.

Thanks
 Mikael

Reply via email to