[hunchentoot-devel] Publishing stream data?

Ram Krishnan rkris at kriyative.net
Fri Sep 28 16:40:15 UTC 2007


Nicolas,

Take a look at the documentation for HUNCHENTOOT:SEND-HEADERS
(http://weitz.de/hunchentoot/#send-headers).

The STREAM returned by SEND-HEADERS can be bound using
WITH-OPEN-STREAM and written to using standard Common Lisp I/O
functions, e.g.,

(with-open-stream (out (hunchentoot:send-headers))
  (write-sequence (make-array pad-len
			      :element-type '(unsigned-byte 8)
			      :initial-element 0)
		  out))

Hope this helps.

-ram

On 9/28/07, Nicolas Neuss <neuss at math.uni-karlsruhe.de> wrote:
> Hello,
>
> I want to return some data in CSV format (or also PDF format in another
> application).  At the moment I am using something like
>
> (let ((file "output.csv"))
>   (with-open-file (stream file :direction :output :if-exists :supersede)
>     (csv-output stream ...))
>   (handle-static-file file)
>   (delete-file file))
>
> However, this is clearly not good in a multiprocessing situation, and I
> would like to get rid of the intermediate file.  Is it possible to publish
> the stream output directly?
>
> Thank you very much,
> Nicolas
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>



More information about the Tbnl-devel mailing list