<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>body{font-family:Helvetica,Arial;font-size:13px}</style>
</head>
<body>
<div style="font-family:Helvetica,Arial;font-size:13px; ">Hi Joachim,</div>
<div style="font-family:Helvetica,Arial;font-size:13px; "><br>
</div>
<div style="font-family:Helvetica,Arial;font-size:13px; ">I think serving files via FileHandler or via callback-registry is pretty much the same performance wise. If you use the callback-registry then the mechanisms that lead to the callback-registry already
 take care of the session-specific stuff. Having a file handler at /files typically allows for using an apache for serving files. In that case however you cannot use the session-key, so your new file-handler will not help much performance wise.</div>
<div style="font-family:Helvetica,Arial;font-size:13px; "><br>
</div>
<div style="font-family:Helvetica,Arial;font-size:13px; ">Kind Regards</div>
<div style="font-family:Helvetica,Arial;font-size:13px; ">Karsten</div>
<br>
<div class="gmail_signature">
<div>— </div>
<div><br>
<span style="white-space: pre-wrap; font-family: -apple-system; font-size: 14px;">Georg Heeg eK</span></div>
<div>
<div class="gmail_signature amz_quote_hidden" style="font-family: -apple-system; font-size: 14px;">
<pre style="white-space: pre-wrap; word-wrap: break-word;">Wallstraße 22
06366 Köthen

Tel.: 03496/214328
FAX: 03496/214712
Amtsgericht Dortmund HRA 12812</pre>
<div><br>
</div>
</div>
</div>
</div>
<br>
<p class="airmail_on">Am 1. April 2021 um 06:59:35, jtuchel@objektfabrik.de (<a href="mailto:jtuchel@objektfabrik.de">jtuchel@objektfabrik.de</a>) schrieb:</p>
<blockquote type="cite" class="clean_bq"><span>
<div>
<div></div>
<div>Jupiter,<br>
<br>
<br>
sorry for my late reply. For some reason, your answer was moved to my <br>
spam folder and I just found it there between lots of pharma and crypto <br>
tips...<br>
<br>
While I see where you are headed with this, I wonder if there are <br>
differences between the approaches. I have the feeling a separate <br>
WAFileHandler might have the advantage of being more decoupled from the <br>
components that consume/refer/use files. And I wonder if a separate <br>
WAFileHandler might decouple things a little more, like allowing for <br>
parallel execution of requests?<br>
<br>
Joachim<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Am 30.03.21 um 14:23 schrieb Jupiter Jones:<br>
> This may be a little left-field, but if you want a more integrated approach you could try something like:<br>
><br>
><br>
> renderContentOn: canvas<br>
> canvas anchor<br>
> url: (self fileAccessUtlFroFile: #restrictedAccessFile);<br>
> with: ‘Download'<br>
><br>
><br>
> fileAccessUrlForFile: fileIdentifier<br>
> ^self renderContext actionUrl copy<br>
> addField:<br>
> (self renderContext callbacks<br>
> store: (WAActionCallback on: [ self processFileAccessCallbackForFile: fileIdentifier ]));<br>
> yourself.<br>
><br>
><br>
> processFileAccessCallbackForFile: fileIdentifier<br>
> (self session isUserAllowedToDownloadFile: fileIndeitifier) ifTrue: [<br>
> self requestContext response redirectTo: (self actualUrlForFile: fileIdentifier)<br>
> ]<br>
><br>
><br>
> You could also serve the file directly in the response rather than #redirectTo: if you wanted added security.<br>
><br>
> The above is incomplete, but perhaps fits the brief.<br>
><br>
> Cheers,<br>
><br>
> Jupiter<br>
><br>
>> On 30 Mar 2021, at 8:18 pm, jtuchel@objektfabrik.de wrote:<br>
>><br>
>> Hi,<br>
>><br>
>><br>
>> There are situations in which I feel like after 10+ years of using Seaside, I am still a newbie. (well, same for Smalltalk after 25+ years, so this may be normal).<br>
>><br>
>> I would like to implement some kind of FileLibrary that is aware of the current session and only delivers files to logged-on users.<br>
>><br>
>> It seems like the best starting point for this is to subclass WARequestHandler and register it with WAAdmin. So the first thing I did was implement handleFiltered: aRequestContext. Unfortunately, neither aRequestContext nor self return a WASession, although
 I entered _s and _k form a logged in session into the address bar of my Browser. This may be a naive approach, but as a fist test case this seemed like a good idea ;-)<br>
>><br>
>> Now the question I ask myself is: how do I teach my WARequestHandler subclass the trick of knowing/finding the current session. Do I add some Filter? Is subclassing WARequestHandler the wrong idea anyways? (I started my experiments with a subclass of WAFileLibrary,
 but that also didn't get me anywhere...).<br>
>><br>
>> I am not asking for a ready-made solution. I'd rather try to understand a little more about Seasides innards here...<br>
>><br>
>> Any pointers? Kick-off ideas what to look at?<br>
>><br>
>><br>
>> tia,<br>
>><br>
>><br>
>> Joachim<br>
>><br>
>><br>
>><br>
>><br>
>> -- <br>
>> -----------------------------------------------------------------------<br>
>> Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de<br>
>> Fliederweg 1 http://www.objektfabrik.de<br>
>> D-71640 Ludwigsburg http://joachimtuchel.wordpress.com<br>
>> Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1<br>
>><br>
>><br>
>> _______________________________________________<br>
>> seaside mailing list<br>
>> seaside@lists.squeakfoundation.org<br>
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br>
> _______________________________________________<br>
> seaside mailing list<br>
> seaside@lists.squeakfoundation.org<br>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br>
<br>
<br>
-- <br>
-----------------------------------------------------------------------<br>
Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de<br>
Fliederweg 1 http://www.objektfabrik.de<br>
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com<br>
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1<br>
<br>
<br>
_______________________________________________<br>
seaside mailing list<br>
seaside@lists.squeakfoundation.org<br>
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br>
</div>
</div>
</span></blockquote>
</body>
</html>