Re: exporting a file from cl-http

Mark Klein <[email protected]> Tue, 5 Jul 2011 15:47:11 -0400
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
--===============3433045084571679823==
Content-Type: multipart/alternative; boundary=Apple-Mail-10-875549475


--Apple-Mail-10-875549475
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


I tried putting the following in my cl-http response function:

(http:with-successful-response (stream '(application octet-stream) =
:additional-headers '(:content-disposition "attachment;filename=3D\"My =
Text File.txt\""))
         =20

but the browser gave me the error:

Internal Server Error

Required arguments in "attachment;filename=3D\"My Text File.txt\"" don't =
match lambda list (HTTP::DISPOSITION . HTTP::PARAM-PLIST).
CL-HTTP/70.216 (Clozure Common Lisp; 0.9.91)


I assume I gave the wrong format for the :content-disposition header; do =
you know what the correct one is?

    Thanks,

	Mark

>>>>>> On Fri, 24 Jun 2011 19:11:13 -0400, Mark Klein said:
>>=20
>> I'd like to provide a button in a cl-http generated web page that =
creates a
>> text file and then downloads it to the user's desktop. How can I do =
that? I
>> have no problem creating a file within a response function, I just =
don't
>> know how to tell the browser to download that file to the user's
>> machine. Any suggestions?
>=20
> Maybe you can adapt the article below, using the content-disposition =
header?
>=20
> =
http://stackoverflow.com/questions/186867/what-content-type-to-force-downl=
oad-of-text-response
>=20
> --=20
> Martin Simmons
> LispWorks Ltd
> http://www.lispworks.com/
>=20
> _______________________________________________
> WWW-CL mailing list
> [email protected]
> https://lists.csail.mit.edu/mailman/listinfo/www-cl

-------------------------------
Mark Klein
Principal Research Scientist
MIT Center for Collective Intelligence
http://cci.mit.edu/klein/




--Apple-Mail-10-875549475
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html lang=3D"en" dir=3D"ltr"><head><base =
href=3D"http://localhost:8000/negowiki/download-scenario?E-1M70A1L-5">
<meta http-equiv=3D"Content-Style-Type" content=3D"text/css">
<link rel=3D"stylesheet" type=3D"text/css" =
href=3D"http://www.cl-http.org:8001/cl-http/css/base.css">
<title>Internal Server Error</title>
</head><body style=3D"-webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><base =
href=3D"http://localhost:8000/negowiki/download-scenario?E-1M70A1L-5"><br>=
<div><div>I tried putting the following in my cl-http response =
function:<br></div><div><br></div><div><div>(http:with-successful-response=
 (stream '(application octet-stream) :additional-headers =
'(:content-disposition "attachment;filename=3D\"My Text =
File.txt\""))</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;</div></div><div><br></div><div>but the browser gave me the =
error:</div><div><br></div><div></div></div>
<div class=3D"header.cl-http">
<h1>Internal Server Error</h1>
<hr></div>
<div class=3D"body.cl-http">
<p></p><pre>Required arguments in "attachment;filename=3D\"My Text =
File.txt\"" don't match lambda list (HTTP::DISPOSITION . =
HTTP::PARAM-PLIST).</pre><p></p>
</div>
<div class=3D"footer.cl-http"><hr><address><a =
href=3D"http://www.cl-http.org:8001/">CL-HTTP/70.216 (Clozure Common =
Lisp; 0.9.91)</a></address></div>


<div><div><br></div><div><br></div><div>I assume I gave the wrong format =
for the :content-disposition header; do you know what the correct one =
is?</div><div><br></div><div>&nbsp;&nbsp; =
&nbsp;Thanks,</div><div><br></div><div><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>Mark</div><br =
class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><div><blockquote type=3D"cite"><blockquote =
type=3D"cite"><blockquote type=3D"cite"><blockquote =
type=3D"cite"><blockquote type=3D"cite">On Fri, 24 Jun 2011 19:11:13 =
-0400, Mark Klein =
said:<br></blockquote></blockquote></blockquote></blockquote></blockquote>=
<blockquote type=3D"cite"><br></blockquote><blockquote type=3D"cite">I'd =
like to provide a button in a cl-http generated web page that creates =
a<br></blockquote><blockquote type=3D"cite">text file and then downloads =
it to the user's desktop. How can I do that? =
I<br></blockquote><blockquote type=3D"cite">have no problem creating a =
file within a response function, I just =
don't<br></blockquote><blockquote type=3D"cite">know how to tell the =
browser to download that file to the user's<br></blockquote><blockquote =
type=3D"cite">machine. Any suggestions?<br></blockquote><br>Maybe you =
can adapt the article below, using the content-disposition =
header?<br><br><a =
href=3D"http://stackoverflow.com/questions/186867/what-content-type-to-for=
ce-download-of-text-response">http://stackoverflow.com/questions/186867/wh=
at-content-type-to-force-download-of-text-response</a><br><br>-- =
<br>Martin Simmons<br>LispWorks =
Ltd<br>http://www.lispworks.com/<br><br>__________________________________=
_____________<br>WWW-CL mailing =
list<br>[email protected]<br>https://lists.csail.mit.edu/mailman/=
listinfo/www-cl<br></div></blockquote></div><br><div>
<div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; =
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; =
-webkit-border-vertical-spacing: 0px; =
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><div>-------------------------------</div><div>Mark =
Klein</div><div>Principal Research Scientist</div><div>MIT Center for =
Collective Intelligence</div><div><a =
href=3D"http://cci.mit.edu/klein/">http://cci.mit.edu/klein/</a></div><div=
><br></div></div></span></div><br class=3D"Apple-interchange-newline">
</div>
<br></body></html>=

--Apple-Mail-10-875549475--


--===============3433045084571679823==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
WWW-CL mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/www-cl

--===============3433045084571679823==--