Subject: Embedding MIDI - msg#00136
List: lang.smalltalk.squeak.seaside
If you use Squeak Comanche package (KomHttpServer) in Squeak 3.8 for serving
files
you may run into the same problem I already described in previous posts
regarding the
changes in the stream hierarchy.
You have to patch the ModFile>>processHttp method in a Squeak 3.8 image with
Comanche and Seaside loaded. Here is the code that works for me in 3.8 to
serve
files correctly:
processHttp
| fullFilePath method fileStream |
method := ModCore method.
(#(#GET #POST) includes: method) ifFalse: [^false].
fullFilePath := ModDoc fullFilePath.
(FileStream isAFileNamed: fullFilePath) ifFalse: [^false].
self processSubModules ifTrue: [^true].
fileStream _ FileDirectory default readOnlyFileNamed: fullFilePath.
fileStream ifNil: [^ false].
HttpResponse current: (HttpResponse
fromStream: (fileStream binary contentsOfEntireFile readStream)).
^true
Bye
Torsten
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: accessing files
I think I can simplify my previous question about embedding MIDI.
It's really a question about accessing files (or file streams) in
general.
Say I create some file (in this 'some.mid'). That file now sits on
the local disk, on the same computer running the Comanche server.
Where do I need to copy that file, so that it can be accessed via
Seaside using (in a renderContentOn: method):
html attributeAt: 'src' put: 'some.mid'
For instance - if I upload the file to the public directory of a
web server on some remote site, I can access successfully access
the file using:
html attributeAt: 'src' put: 'http://www.somwhere.com/some.mid'
However I can't figure out how to accomplish the same thing on
the computer hosting Seaside itself.
I've tried each of the following:
html attributeAt: 'src' put: 'http://localhost:9090/some.mid'
html attributeAt: 'src' put: 'http://localhost:9090/seaside/some.mid'
html attributeAt: 'src' put:
'http://localhost:9090/seaside/myapp/some.mid'
html attributeAt: 'src' put: 'some.mid'
html attributeAt: 'src' put: 'seaside/some.mid'
html attributeAt: 'src' put: 'seaside//myapp/some.mid'
But in each case the file cannot be found.
Do I need to somehow upload the file from disk, of from a stream,
into a Seaside (or Comanche) directory structure? Do I need to
have some kind of file server running beyond the web server? I've
been looking through the tutorials but can't find any examples.
I did try starting a HttpService using an exmaple from the list:
ma := ModuleAssembly core.
ma serverRoot: FileDirectory default fullName.
ma documentRoot: FileDirectory default fullName.
ma directoryIndex: 'index.html index.htm'.
ma serveFiles.
(HttpService startOn: 8080 named: 'httpd') plug: ma rootModule
and then using:
html attributeAt: 'src' put: 'http://localhost:8080/some.mid'
but no luck there either.
Sorry if I'm missing something real obvious.
Thanks again very much for any pointers,
Jay
Next Message by Date:
click to view message preview
RE: LiveUpdates and Request for Merging :-)
Hi,
Thanks for keeping the SeasideAsync package going! I am finding the package
very helpful.
I have loaded SeasideAsync-mb.2 and came across a weird scenario.
I have a little log file viewer that basically updates the display every x
seconds with the new log file contents. I use refreshDivWith:every: to achieve
this. The file stream is basically written to the display like this:
renderStream: aStream on: html
aStream reset.
[ aStream atEnd ] whileFalse: [
| aLine |
aLine := aStream nextLine.
html text: (aLine copyWithoutAll: {Character cr. Character
lf}); break
]
In Mozilla my output looks like it always did:
Log file line 1
Log file line 2
Log file line 3
Log file line 4
Log file line 5
In IE and Opera I now have an empty line after every line:
Log file line 1
Log file line 2
Log file line 3
Log file line 4
Log file line 5
This can become a little bit anoying. I have a feeling this behaviour has
something to do with the change in the new version that replaces every " "
with " ", but I am not sure.
Any ideas on getting IE and Opera not to put a new line after every line?
Thank you,
Mart-Mari
-----Original Message-----
From: Michel Bany [mailto:m.bany@xxxxxxxxxx]
Sent: 30 Oktober 2005 08:38 nm
To: renggli@xxxxxxxxxxxx; The Squeak Enterprise Aubergines Server - general
discussion.
Subject: Re: [Seaside] LiveUpdates and Request for Merging :-)
Lukas Renggli a écrit :
>>Well, I'm unlikely to release any new versions of SeasideAsync myself
>>- my focus has moved to the Scriptaculous package. So I suggest you
>>just run with it, though it would be good to coordinate with the
>>others (esp. Michel) that are working in that area.
>>
>>
>
>Okay, I published my fixes as proposed to SeasideAsync-lr.2. I will
>check out Scriptaculous again, probably this is a better way to go ...
>
>
>
And I published SeasideAsync-mb.3.
This gives life to checkboxes, handles <script> from live callbacks,
handles nested live callbacks
and provides support for updating an arbitrary number of areas of the
html document.
Enjoy,
Michel.
_______________________________________________
Seaside mailing list
Seaside@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Previous Message by Thread:
click to view message preview
Re: accessing files
I think I can simplify my previous question about embedding MIDI.
It's really a question about accessing files (or file streams) in
general.
Say I create some file (in this 'some.mid'). That file now sits on
the local disk, on the same computer running the Comanche server.
Where do I need to copy that file, so that it can be accessed via
Seaside using (in a renderContentOn: method):
html attributeAt: 'src' put: 'some.mid'
For instance - if I upload the file to the public directory of a
web server on some remote site, I can access successfully access
the file using:
html attributeAt: 'src' put: 'http://www.somwhere.com/some.mid'
However I can't figure out how to accomplish the same thing on
the computer hosting Seaside itself.
I've tried each of the following:
html attributeAt: 'src' put: 'http://localhost:9090/some.mid'
html attributeAt: 'src' put: 'http://localhost:9090/seaside/some.mid'
html attributeAt: 'src' put:
'http://localhost:9090/seaside/myapp/some.mid'
html attributeAt: 'src' put: 'some.mid'
html attributeAt: 'src' put: 'seaside/some.mid'
html attributeAt: 'src' put: 'seaside//myapp/some.mid'
But in each case the file cannot be found.
Do I need to somehow upload the file from disk, of from a stream,
into a Seaside (or Comanche) directory structure? Do I need to
have some kind of file server running beyond the web server? I've
been looking through the tutorials but can't find any examples.
I did try starting a HttpService using an exmaple from the list:
ma := ModuleAssembly core.
ma serverRoot: FileDirectory default fullName.
ma documentRoot: FileDirectory default fullName.
ma directoryIndex: 'index.html index.htm'.
ma serveFiles.
(HttpService startOn: 8080 named: 'httpd') plug: ma rootModule
and then using:
html attributeAt: 'src' put: 'http://localhost:8080/some.mid'
but no luck there either.
Sorry if I'm missing something real obvious.
Thanks again very much for any pointers,
Jay
Next Message by Thread:
click to view message preview
LiveUpdates and Request for Merging :-)
Hi Avi,
I ask that you replacing the current implementation of
#urlForLiveRequest: with the following code:
urlForLiveRequest: aBlock
| request text response renderer document |
" this is new "
request := Continuation currentDo: [ :cc |
^ WACurrentSession value
actionUrlForContinuation: cc ].
" this left unchanged "
text := request at: 's' ifAbsent: [ ].
response := WAResponse new.
renderer := WARenderCanvas
context: self context copy
callbacks: self callbacks.
document := WAHtmlStreamDocument new
stream: response stream.
renderer context document: document.
aBlock value: text value: renderer.
document close.
WACurrentSession value
returnResponse: response.
The original implementation does not use a continuation and therefor
evaluates the rendering block in quite a strange context. I tested my
enhancement with the included tests and do not see problems.
So you certainly ask, why don't I just publish my modification to
SqueakSource? I will do but ...
I noticed that I sort of started to fork Seaside, even tough I am
always trying to merge in the latest changes of all other commits. I
am forced to fix and enhance a lot of things for Magritte and
SmallWiki 2 in Seaside, that I cannot just do with method extensions.
The change that I require above is yet in another package
(SeasideAsync), and I will have to fork that as well if you don't
update the official packages. Having an official Seaside and one for
Magritte/SmallWiki will lead to confusion, as it already did ... :-(
Please could you merge in my changes from time to time?
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch