A last question concerning my problem :s<div><br></div><div>I'd like to create a file and to send it to the client when he clicks on a link (only one click for both actions).</div><div>Here is what I tried:</div><div><br>
</div><div><div>(html anchor)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>callback: </div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div>[ </div></div></blockquote><div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[ </div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>"write in a file and save it on the server's harddisk"</div></div></blockquote></blockquote><div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> fileWriter handleFile: row nameOfCollection from: row.<span class="Apple-tab-span" style="white-space:pre">        </span></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>"get the content of the previously created file and send it to the client"<span class="Apple-tab-span" style="white-space:pre">                                </span></div>
</div></blockquote></blockquote><div><div><span class="Apple-tab-span" style="white-space:pre"></span></div></div><div><div><span class="Apple-tab-span" style="white-space:pre"></span></div></div><div><div><span class="Apple-tab-span" style="white-space:pre">                </span> contents := fileLibrary documentForFile: row nameOfCollection , '.xml'.<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> self session</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> returnResponse: (WAResponse new document: contents mimeType: 'text/xml' fileName: row nameOfCollection).</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> parent warning: 'The file has been exported to your computer' ]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> on: FileExistsException</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> do: [ :exception | parent warning: exception messageText ] ];</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>with: 'export'.</div>
</div><div><br></div><div>I get the following error: <meta charset="utf-8"><span class="Apple-style-span" style="font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif; line-height: 21px; "><h2 style="color: rgb(1, 89, 141); margin-bottom: 0.5em; font-weight: normal; margin-top: 2px; margin-right: 0px; margin-left: 0px; font-size: 14px; ">
WAError: My subclass should have overridden #stream</h2><div style="color: rgb(42, 42, 42); ">I don't really understand WAResponse, it seams the documentation is out-of-date.</div><div style="color: rgb(42, 42, 42); ">
For example the following code is in the seaside book (<a href="http://www.seaside.st/documentation/faq/how-to">http://www.seaside.st/documentation/faq/how-to</a>) and doesn't work anymore because the method "document:mimeType:fileName:" is now on the instance side...</div>
<div><meta charset="utf-8"><span class="Apple-style-span" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 18px; "><h1 style="margin-bottom: 15px; color: rgb(1, 89, 141); font-weight: normal; ">
<font class="Apple-style-span" size="2">Is there a convenient way to make the document be created after the link is clicked?</font></h1><p style="margin-bottom: 15px; font-size: 12px; color: rgb(0, 40, 66); ">Yes, this is a common problem. One solution is to create an anchor and redirect:</p>
<pre class="shout" style="margin-left: 2em; font-size: 12px; color: rgb(0, 40, 66); "><span class="undefinedIdentifier" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 136); ">html</span> <span class="unary" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">anchor</span><br>
<span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">callback:</span> <span class="blockStart" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">[</span> <br>
<span class="self" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 136, 136); ">self</span> <span class="unary" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">session</span> <span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">returnResponse:</span> <span class="leftParenthesis1" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">(</span><span class="globalVar" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 136); ">WAResponse</span> <br>
<span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">document:</span> <span class="undefinedIdentifier" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 136); ">anObject</span> <br>
<span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">mimeType:</span> <span class="undefinedIdentifier" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 136); ">aMimeType</span> <br>
<span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">fileName:</span> <span class="undefinedIdentifier" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 136); ">aString</span><span class="rightParenthesis1" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">)</span> <span class="blockEnd" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">]</span><span class="cascadeSeparator" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">;</span><br>
<span class="keyword" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">with:</span> <span class="string" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(136, 0, 136); ">'Export'</span><span class="statementSeparator" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); ">.</span></pre>
<pre class="shout" style="margin-left: 2em; font-size: 12px; ">Thank you for your time.</pre><pre class="shout" style="margin-left: 2em; font-size: 12px; ">alex</pre></span></div><div style="font-size: 14px; color: rgb(42, 42, 42); ">
<br></div></span><br><div class="gmail_quote">2010/12/18 alexandre bp <span dir="ltr"><<a href="mailto:abalonpe@ulb.ac.be">abalonpe@ulb.ac.be</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thx a lot everyone I think I have got what I need to understand how it works.<div>I have already written exactly what I want thx to you. :-)</div><div>cheers</div><div>alex<br><br><div class="gmail_quote">
2010/12/18 Bob N. <span dir="ltr"><<a href="mailto:bobn@rogers.com" target="_blank">bobn@rogers.com</a>></span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Here's some old code that I've been using. There may be a more current option. <div>
---</div><div>In the 'download file' callback method... </div><div><div><span style="white-space:pre-wrap">        </span>byteArray := [path asFilename contentsOfEntireBinaryFile]</div>
<div><span style="white-space:pre-wrap">                </span>on: Error</div><div><span style="white-space:pre-wrap">                </span>do: [:ex | ex description].</div><div><span style="white-space:pre-wrap">        </span>byteArray isString ifTrue: [^self parent prompt: byteArray title: 'Error reading: ', path asString].</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>self session </div><div><span style="white-space:pre-wrap">                </span>downloadBinary: byteArray </div><div><span style="white-space:pre-wrap">                </span>mimeType: (WAFileLibrary mimetypeFor: self fileSuffix) </div>
<div><span style="white-space:pre-wrap">                </span>filename: filename</div><div>---</div><div><div>(my session class)>>downloadBinary: aContents mimeType: aMimeType filename: aFileName</div><div><br>
</div><div><span style="white-space:pre-wrap">        </span>self requestContext respond: [:response |</div><div><span style="white-space:pre-wrap">                </span>response</div><div><span style="white-space:pre-wrap">                        </span>contentType: aMimeType;</div>
<div><span style="white-space:pre-wrap">                        </span>binary; </div><div><span style="white-space:pre-wrap">                        </span>nextPutAll: aContents; </div><div><span style="white-space:pre-wrap">                        </span>doNotCache;</div>
<div><span style="white-space:pre-wrap">                        </span>attachmentWithFileName: aFileName;</div><div><span style="white-space:pre-wrap">                        </span>headerAt: 'Content-length' put: aContents size printString;</div>
<div><span style="white-space:pre-wrap">                        </span>yourself]</div></div><div><div></div><div><div><br></div><br><div class="gmail_quote">On Sat, Dec 18, 2010 at 10:46 AM, alexandre bp <span dir="ltr"><<a href="mailto:abalonpe@ulb.ac.be" target="_blank">abalonpe@ulb.ac.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Thank you for you reply.</div>yes but the problem is that I don't understand how to give the file to the client from the file library....<div>
It must be very stupid but I have never done it (even in PHP) so I have no clue...</div>
<div>cheers </div><div>alex</div><div><br><div class="gmail_quote">2010/12/17 Sean Allen <span dir="ltr"><<a href="mailto:sean@monkeysnatchbanana.com" target="_blank">sean@monkeysnatchbanana.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can put downloadable content in a file library or serve directly from the file system via the webserver w/o going through Seaside.<br>
<br><div class="gmail_quote"><div><div></div><div>On Fri, Dec 17, 2010 at 12:10 PM, alexandre bp <span dir="ltr"><<a href="mailto:abalonpe@ulb.ac.be" target="_blank">abalonpe@ulb.ac.be</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>Hi,<div><br></div><div>I'd like to add a downloadable content on my website and I don't have any idea how to do that. </div>
<div>I saw the fileUpload method in the WARenderCanvas to upload a file on the server but I don't find anything to download a file from it...</div>
<div>Where should I put the downloadable file and how to export it to the computer of the client?</div><div><br></div><div>Thx in advance,</div><div><br></div><div>alex</div>
<br></div></div>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div></div></div><br></div>
</blockquote></div><br></div>