[Seaside] Re: serving files from seaside

Jay Hardesty jayh at panix.com
Mon Mar 20 04:03:52 UTC 2006


Yanni Chiu wrote:

> If the question were about serving files from Squeak/Kom/Seaside,
> then there's an answer in the description for KomHttpServer at:
>    http://map.squeak.org/package/0fdb5ffc-cfa1-4d40-96c2-fe325bc8ba5f
>
> Here's the code from that page:
>
> | ma seaside |
> seaside := WAKom default.
> ma := ModuleAssembly core.
> ma serverRoot: FileDirectory default fullName.
> ma alias: '/seaside' to: [ma addPlug: [:request | seaside process: 
> request]].
> ma documentRoot: FileDirectory default fullName.
> ma directoryIndex: 'index.html index.htm'.
> ma serveFiles.
> (HttpService startOn: 8080 named: 'httpd') plug: ma rootModule
>
> Also, have a look at my posting from half-an-hour prior to yours,
> about seasidehosting.st
>
> Note that it's likely that the file will be read into Squeak memory
> before being served. That may or may not be a problem.


I've been unable to successfully serve any files from Seaside.
(I've instead been saving the streams to an FTP site, and then
serving from the FTP site to get around the problem...)

The above code snippet raises more questions for me.  Does this code
have to be executed every time the contents of the directory changes
(every time a new file is produced)?   Do I need to create and update
the files "index.htm" and "index.html" to reflect the contents of the 
directory?
Do I need to restart the HttpService on port 8080 every time a new file
is added to the directory.

Suppose I want to serve a MIDI file named "some.midi", which sits in the
same directory pointed to by "FileDirectory default", and then have my 
Seaside
page load the file into a player as follows (having started Seaside
and executed the HTTPServer code snippet quoted above):

		fileName = 'some.midi'.
		html
			attributeAt: 'src' put: fileName;
			attributeAt: 'controls' put: 'true';
			tag: 'embed'.

Which doesn't work. I just see a question mark where the player should 
be.
So, should that first line instead be:
fileName = 'http://localhost:9090/some.midi'.
or
fileName = 'http://localhost:8080/some.midi'.
or
fileName = 'http://localhost:9090/seaside/some.midi'.
or
fileName = 'http://localhost:8080/seaside/some.midi'.
or
Any of the above with "httpd" instead of "http"
or
fileName = 'http://some.midi'.
or
fileName = 'httpd://some.midi'.
or
fileName = 'seaside/some.midi'

None of these seem to work.  Is it because an "index.html" file is 
required (physically
located on disk at the location pointed to by "FileDirectory default")? 
   Where does
the disk-based file directory intersect the file directory seen by 
Seaside?
Do "FileDirectory default" and "http://localhost:9090/seaside" point to 
the same
directory?

I'll admit my knowledge of networking and the web is very fragmentary, 
but hopefully
there's a succinct way of accomplishing this simple operation....??

Thanks, again, for any help,
Jay




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 5060 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20060319/8cad4644/attachment.bin


More information about the Seaside mailing list