<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Sven, <br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I started with a WAFileLibrary subclass
      first. I couldn't get it to work the way I wanted. <br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">One of the problems is that all
      FileLibraries added by addLibrary: end up as an endpoint in the
      /files path, unless I also register a WAFileHandler (subclass) at
      another endpoint. In my case, I'd like to separate things: /files
      is for "public" files, and then there should be /attachments for
      "private" stuff of my users. AFAIK there is no way to register an
      additional File Library in another path/endpoint then /files, or
      is there? (this really is a question, not an argument...). Why do
      I want that? Because I want to keep the configuration of the
      frontend web server (Apache in my case) simple. Redirecting all
      requests of /files and subdirectories to some folder is easy. Not
      sure whether redirecting all but one is just as easy...?</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The other one is that a WAFileLibrary
      subclass doesn't know its session either. As an experimented I
      added this override to one of my FileLibraries:</div>
    <div class="moz-cite-prefix">
      <pre>
</pre>
    </div>
    <div class="moz-cite-prefix">
      <pre>handle: aRequestContext
   self session ifNotNil: [:s| s halt].
   super handle: aRequestContext</pre>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">And it never halts. This makes some
      sense, because in order to save files, you don't need a session.
      Anybody can have these files. And that is what I don't want for
      some files...<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">So I started subclassing WAFileHandler
      and found out a FileHandler doesn't know the session either . But
      I want to have access to the logged-ob user in the session. So it
      seems I either have to subclass from something else or add
      "something" to my WAFileHandler in the Application configuration,
      like a Filter or whetever...</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">So either I need to know something more
      about FileLibraries (register at something else than /files, make
      them session aware) or FileLibrary is not what I  have to
      subclass...</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Any more ideas?</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Joachim<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Am 30.03.21 um 11:51 schrieb Sven Van
      Caekenberghe:<br>
    </div>
    <blockquote type="cite"
      cite="mid:06888D19-32DD-4145-B552-F13A447453ED@stfx.eu">
      <pre class="moz-quote-pre" wrap="">Hi Joachim,

I would try to look at WAFileHandler, which is responsible for serving the files.

It seems to delegate most work to WAFileLibrary>>#handle:

Maybe you can subclass WAFileLibrary (insert your superclass before your concrete class) to check the session for a login.

Sven

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On 30 Mar 2021, at 11:18, <a class="moz-txt-link-abbreviated" href="mailto:jtuchel@objektfabrik.de">jtuchel@objektfabrik.de</a> wrote:

Hi,


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).

I would like to implement some kind of FileLibrary that is aware of the current session and only delivers files to logged-on users.

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 ;-)

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...).

I am not asking for a ready-made solution. I'd rather try to understand a little more about Seasides innards here...

Any pointers? Kick-off ideas what to look at?


tia,


Joachim




-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          <a class="moz-txt-link-freetext" href="mailto:jtuchel@objektfabrik.de">mailto:jtuchel@objektfabrik.de</a>
Fliederweg 1                         <a class="moz-txt-link-freetext" href="http://www.objektfabrik.de">http://www.objektfabrik.de</a>
D-71640 Ludwigsburg                  <a class="moz-txt-link-freetext" href="http://joachimtuchel.wordpress.com">http://joachimtuchel.wordpress.com</a>
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          <a class="moz-txt-link-freetext" href="mailto:jtuchel@objektfabrik.de">mailto:jtuchel@objektfabrik.de</a>
Fliederweg 1                         <a class="moz-txt-link-freetext" href="http://www.objektfabrik.de">http://www.objektfabrik.de</a>
D-71640 Ludwigsburg                  <a class="moz-txt-link-freetext" href="http://joachimtuchel.wordpress.com">http://joachimtuchel.wordpress.com</a>
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


</pre>
  </body>
</html>