Hello everbody,
Coincidently playing with hunchentoot yesterday I encountered the same problem with streams. Based in the code of HANDLE-STATIC-FILE a made a path with 2 functions and one macro:
make-http-output-stream witch send the appropriate headers and return a stream. This function deal with content-type and content-disposition headers.
with-http-output-stream Create an http-output-stream, run the code and call finish-output
handle-stream Copy the stream to the http-output
I hope to contribute to the hunchetoot development.
Att. Leonardo Varuzza. USP - Brazil.
PS: A interesting use of this patch is to send images created by Zach Brene's Vecto library. I just send another patch to him to enable saving the result png to a stream.
On 10/1/07, Nicolas Neuss neuss@math.uni-karlsruhe.de wrote:
Nicolas Neuss neuss@math.uni-karlsruhe.de writes:
(define-easy-handler (csv-export-page :uri "/csv-export") ((csv :parameter-type 'boolean) ...) (when csv (setf (content-type) "text/comma-separated-values" (header-out "Last-Modified") (rfc-1123-date (get-universal-time)) (content-length) nil) (let ((out (send-headers))) (csv-output :stream out ...))) (with-output-to-string (out) (fill-and-print-template "csv-export.html" values :stream out)))
As much as I can see, this works.
In the code, ... denote some further parameters which can be configured via the csv-export page.
Nicolas _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel