<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 12-09-03 10:47 PM, H. Hirzel wrote:<br>
</div>
<blockquote
cite="mid:CAGQxfVgrsVsi1M7HfN1hE2t0cBtQVAk4S4QeV7c2QrfqxHU74Q@mail.gmail.com"
type="cite">
<pre wrap="">Thank you Chris for this example.
It is illustrative for me.
Only two classes
ALDirectoryListApplication (subclass of ALApplication, 1 method)
ALDirectoryListPage (4 methods)
plus a method in ALDigestLocator
Remark: I would not hard code the directory listed ('package-cache')
into the #renderBodyOn: method
renderBodyOn: html
        | docroot scanner |
        docroot := FSLocator imageDirectory / 'package-cache'.
        scanner := ALDirectoryScanner scan: docroot into: locator.
        scanner resources keys do: [: ea | html a href: ea asString; with: ea
asString. html br ]
but instead set it in
ALDirectoryListApplication>>initializeLocator
        locator
                at: ALPath root
                put: (ALHtmlResource component: (ALDirectoryListPage new locator: locator))
something like:
ALDirectoryListApplication>>initializeLocator
        locator
                at: ALPath root
                put: (ALHtmlResource component:
(ALDirectoryListPage locator: locator
docroot: FSLocator
imageDirectory / 'package-cache'.))
BTW what is an ALDigestLocator?
At the moment cannot comment on more substantial things as I have to
start reading the few notes (Colin, Frank Sch.) and do more browsing
of the code...
Regards
Hannes
P.S. I thought there is a counter example around somewhere as well. It
is not in Colin's code. Where do I find it?
On 9/3/12, Chris Cunnington <a class="moz-txt-link-rfc2396E" href="mailto:smalltalktelevision@gmail.com"><smalltalktelevision@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I've taken a crack at creating an app that lists the contents of a
directory as links. Hit a link and it downloads the file in the
package-cache. Does ALDigestLocator want a #resources getter? Is this
bad design? I have no idea.
Chris
It's available here:
<a class="moz-txt-link-freetext" href="http://ss3.gemstone.com/ss/Oakville/">http://ss3.gemstone.com/ss/Oakville/</a>
server := ALServer on: 8624 application: ALDirectoryListApplication new.
server start.
server isRunning
server stop
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
The examples are in this package. It includes the ALCounterExample.
<br>
<br>
<meta charset="utf-8">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><a href="http://source.wiresong.ca/al/AL-Examples-cwp.11.mcz">http://source.wiresong.ca/al/AL-Examples-cwp.11.mcz</a> </pre>
<br>
ALDigestLocator connects URLs to resources. Tokens typed as a URL
address are referred to ALDigestLocator to point to the correct
instance of ALHtmlResource, ALJsonResource, ALFileResource, etc. <br>
<br>
Yea, you've hit on a point that's probably hackish. I've pushed
stuff into the page class which should probably be in the
application class. I think there's a rendering/model split I'm
stepping on. I guess I'm not sure how the page should access
application data such as stored in the #locator instvar, which
contains the ALDigestLocator instance. That's where I'm getting the
names of the files. <br>
<br>
Chris <br>
<br>
<br>
</body>
</html>