[hunchentoot-devel] Publishing stream data?
Leonardo Varuzza
varuzza at gmail.com
Mon Oct 1 12:13:47 UTC 2007
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 at math.uni-karlsruhe.de> wrote:
> Nicolas Neuss <neuss at 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 at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
--
The most fundamental particles in this product are held together by a
"gluing" force about which little is currently known and whose
adhesive power can therefore not be permanently guaranteed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: with-http-output-stream.patch
Type: text/x-patch
Size: 2744 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20071001/e9a1831a/attachment.bin>
More information about the Tbnl-devel
mailing list