On Feb 26, 1:29 pm, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote: > On Fri, Feb 26, 2010 at 12:06 PM, Jeppe Nejsum Madsen <je...@ingolfs.dk> > wrote: > > > So the thread creation/scheduling and the two times file copying could be > > avoided by writing directly to the output stream. But I agree this would > > have to be special cased somehow. It's not an urgent issue atm, but I'll > > try to see if some clean solution can be implemented. > > An idea just struck :-) Could this be handled in much the same way as > a redirect? Something like > > S.sendFile("application/pdf", "myfilename.pdf", outputStream => > mylibrary.write(outputStream)) > > this would throw an exception like ResponseShortcutException, lift > would intercept it, write the appropriate headers and execute the > passed function with the response outputstream as parameter. > > This would prohibit accidental output to response. > > Thoughts?
I would prefer something like : final case class OutputStreamingResponse(data: (OutputStream) => Unit, size: Long, headers: List[(String, String)], cookies: List[HTTPCookie], code: Int) extends BasicResponse { .. } hence remain consistent with Lift's response paradigm. We *COULD* provide the OutputStrem from the servlet response but that would be ok since we are in a LiftResponse and NOT inside the rendering pipeline. > > /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.