Is there a magic trick to serving graphic files via comanche? Do I need to do something with the ImageReaderWriter? Like:
http://lists.squeakfoundation.org/pipermail/seaside/2004-September/003640.ht...
Just to be clear here is the directory structure: public_html/ index.html "has <img src="logo.gif"/> " logo.gif
The page is served without the graphic.
Thanks, Wilkes
There is a bug in Kom under Squeak 3.8. If you are using Squeak 3.8 or higher apply the attached workaround. I submitted it to Goran but have no idea when to expect it in live Kom distribution (Goran?). Anyway I hope this helps...
David
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 26 October 2005 at 5:22:22 pm'! !ModFile methodsFor: 'processing' stamp: 'cds 10/26/2005 17:21'! processHttp | fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: ((FileDirectory default readOnlyFileNamed: fullFilePath) binary; yourself)). ^true! !
It looks like this is fixed in the latest version. Here is the code that is in 7.0.3 (KomHttpServer-gk.10)
processHttp "This method uses StandardFileStream explicitly instead of relying on FileStream class>>concreteStream, since in this case we just need to return the file 'as is' binary."
| fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: (StandardFileStream readOnlyFileNamed: fullFilePath)). ^true
On 12/22/05, David Shaffer cdshaffer@acm.org wrote:
There is a bug in Kom under Squeak 3.8. If you are using Squeak 3.8 or higher apply the attached workaround. I submitted it to Goran but have no idea when to expect it in live Kom distribution (Goran?). Anyway I hope this helps...
David
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 26 October 2005 at 5:22:22 pm'! !ModFile methodsFor: 'processing' stamp: 'cds 10/26/2005 17:21'! processHttp | fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: ((FileDirectory default readOnlyFileNamed: fullFilePath) binary; yourself)). ^true! !
Seaside mailing list Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Hi all and happy new year :)
My questions are related to Comanche and serving static files.
I want comanche to serve static files and seaside application. The latter is ok and static files is also ok as long as it is html... but I cannot view for instance an image file (.jpg .bmp ...)... the processor hangs (os: linux). Is it normal ? is it due to what's said in this post ?
I used the following configuration (I probably do not understand how comanche works). If someone can tell what's done by this few lines, that would propably help me (how web server work is not clear for me)? Is there a tutorial or other for that... http://www.shaffer-consulting.com/david/Seaside/KomHelp/ does not work
| ma seaside | seaside := WAKom default. ma := ModuleAssembly core. ma serverRoot: (FileDirectory default directoryNamed: 'Files') fullName. ma alias: '/seaside' to: [ma addPlug: [:request | seaside process: request]]. ma documentRoot: (FileDirectory default directoryNamed: 'FileRoot') fullName. ma directoryIndex: 'index.html index.htm'. ma serveFiles. (HttpService startOn: 9090 named: 'httpd') plug: ma rootModule
Last thing, is it better to serve these static files through Comanche or Apache (knowing that I'll use Apache with the mod_proxy in front of squeak ) ?
Thanks for all Cédrick
Wilkes Joiner a écrit :
It looks like this is fixed in the latest version. Here is the code that is in 7.0.3 (KomHttpServer-gk.10)
processHttp "This method uses StandardFileStream explicitly instead of relying on FileStream class>>concreteStream, since in this case we just need to return the file 'as is' binary."
| fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: (StandardFileStream readOnlyFileNamed: fullFilePath)). ^true
On 12/22/05, David Shaffer cdshaffer@acm.org wrote:
There is a bug in Kom under Squeak 3.8. If you are using Squeak 3.8 or higher apply the attached workaround. I submitted it to Goran but have no idea when to expect it in live Kom distribution (Goran?). Anyway I hope this helps...
David
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 26 October 2005 at 5:22:22 pm'! !ModFile methodsFor: 'processing' stamp: 'cds 10/26/2005 17:21'! processHttp | fullFilePath method | method := ModCore method. (#(#GET #POST) includes: method) ifFalse: [^false]. fullFilePath := ModDoc fullFilePath. (FileStream isAFileNamed: fullFilePath) ifFalse: [^false]. self processSubModules ifTrue: [^true]. HttpResponse current: (HttpResponse fromStream: ((FileDirectory default readOnlyFileNamed: fullFilePath) binary; yourself)). ^true! !
Seaside mailing list Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Seaside mailing list Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
I want comanche to serve static files and seaside application. The latter is ok and static files is also ok as long as it is html... but I cannot view for instance an image file (.jpg .bmp ...)... the processor hangs (os: linux). Is it normal ? is it due to what's said in this post ?
oups I missed a post that gave this adress: http://coweb.cc.gatech.edu/cs2340/2913 . Sorry !
"Don't assume it knows where your data files are stored, because it doesn't, plus that would be of no help anyway ****since it can't directly display an image sitting in your squeak directory.****"
... form := Form fromFileNamed: 'squeaken.gif' ...
(request url asLowercase endsWith: '.gif') ifTrue: [^form]. ...
Do we need to do something like that to serve files ? anyway I'll spend some time to dig into KomHttp... If someone knows a tutorial on that, please tell me
Hi!
=?ISO-8859-1?Q?C=E9drick_B=E9ler?= cbeler@enit.fr wrote:
I want comanche to serve static files and seaside application. The latter is ok and static files is also ok as long as it is html... but I cannot view for instance an image file (.jpg .bmp ...)... the processor hangs (os: linux). Is it normal ? is it due to what's said in this post ?
"processor hangs"? What Squeak and version of KomHttpServer do you use?
oups I missed a post that gave this adress: http://coweb.cc.gatech.edu/cs2340/2913 . Sorry !
"Don't assume it knows where your data files are stored, because it doesn't, plus that would be of no help anyway ****since it can't directly display an image sitting in your squeak directory.****"
... form := Form fromFileNamed: 'squeaken.gif' ...
(request url asLowercase endsWith: '.gif') ifTrue: [^form]. ...
Do we need to do something like that to serve files ?
No. :) Right now I don't have time testing your issue - but this code I just verified in a 3.8 image with latest KomHttpServer (on win32):
| ma | 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
It serves gif-files just fine.
anyway I'll spend some time to dig into KomHttp... If someone knows a tutorial on that, please tell me
Tutorials for KomHttpServer... can't really say that I know of any.
But to play a bit with KomHttp I recommend installing HttpView2 on top of it and playing with the examples - read the class comments. HttpView2 is a lightweight layer on top of KomHttpServer.
regards, Göran
"processor hangs"? What Squeak and version of KomHttpServer do you use?
I tried on the 3.8 version and 3.9a-traits
KomHttpServer7.0.1 !! argh !! didn't see there were newer version for 3.8 !!! it just works fine with the last version (7.0.3) sorry !!!!
Tutorials for KomHttpServer... can't really say that I know of any.
I found some old wiki pages that explain a bit how it works... http://minnow.cc.gatech.edu/swiki/7
But to play a bit with KomHttp I recommend installing HttpView2 on top of it and playing with the examples - read the class comments. HttpView2 is a lightweight layer on top of KomHttpServer.
Ok done ;)
Thanks for all Göran
Cédrick
seaside@lists.squeakfoundation.org