问题描述:

1)I had a set of ".js" files in a particular Directory structure.

2)I NEED to store them locally with my smalltalk image and need not want to host them seperately.

3) I DONT need to keep them inside the smalltalk image, with the WAFileLibrary.

Please let me know how the following code needs to be modified for my requirement.

anHtmlRoot javascript url: 'http://www.google.com/jsapi'.

Something like the following..?

anHtmlRoot javascript url: "/myfolder/MyFile.js"

Help

Varun Isac

网友答案:

You can indeed write:

anHtmlRoot javascript url: '/myfolder/MyFile.js'

but it's better to use:

    anHtmlRoot javascript resourceUrl: 'MyFile.js'

Which allows you to setup the path as a configuration parameter. More on that in the Seaside book.

To serve the actual file, there are two options:

  • serve the file from disk with an external webserver (on the same machine)
  • serve the file from disk using the internal Smalltalk webserver

For the latter option, you can load the Seaside-Filesystem package from the Seaside30LGPL repository. Once loaded, you can define an 'external directory' handler for your 'myFolder' directory using the Seaside config tool and that handler will serve the files from the disk.

相关阅读:
Top