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: http://ss3.gemstone.com/ss/Oakville/ server := ALServer on: 8624 application: ALDirectoryListApplication new. server start. server isRunning server stop |
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 <[hidden email]> wrote: > 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: > > http://ss3.gemstone.com/ss/Oakville/ > > > server := ALServer on: 8624 application: ALDirectoryListApplication new. > server start. > > server isRunning > > server stop > > |
On 12-09-03 10:47 PM, H. Hirzel wrote:
The examples are in this package. It includes the ALCounterExample.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 [hidden email] wrote: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: http://ss3.gemstone.com/ss/Oakville/ server := ALServer on: 8624 application: ALDirectoryListApplication new. server start. server isRunning server stop http://source.wiresong.ca/al/AL-Examples-cwp.11.mcz 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. 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. Chris |
Illustrative indeed!
server := ALServer on: 8081 application: ALExampleApplication new. server start. server isRunning server stop shows the four examples - ALEncodingExample. - ALStreamingExample. - ALCounterExample. - ALAjaxCounterExample. The HTML rendering is more or less done as in Seaside it seems. --Hannes On 9/4/12, Chris Cunnington <[hidden email]> wrote: > On 12-09-03 10:47 PM, H. Hirzel wrote: >> 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 <[hidden email]> wrote: >>> 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: >>> >>> http://ss3.gemstone.com/ss/Oakville/ >>> >>> >>> server := ALServer on: 8624 application: ALDirectoryListApplication new. >>> server start. >>> >>> server isRunning >>> >>> server stop >>> >>> > The examples are in this package. It includes the ALCounterExample. > > http://source.wiresong.ca/al/AL-Examples-cwp.11.mcz > > > 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. > > 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. > > Chris > > > |
Free forum by Nabble | Edit this page |