I've started to use ZnZincStaticServerAdaptor but I can't get the behavior I want. When using > ZnZincStaticServerAdaptor startOn: 8080 andServeFilesFrom: (FileLocator imageDirectory / 'assets'). > ZnZincStaticServerAdaptor default server debugMode: true. ZnSeasideServerAdaptorDelegate>handleRequest: znRequest response := self adaptor process: znRequest. ^ (response isError and: [ response isAuthenticationRequired not ]) ifTrue: [ self staticDelegate handleRequest: znRequest ] ifFalse: [ response ]. Francois _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On 09 Apr 2014, at 16:59, François Stephany <[hidden email]> wrote: > I've started to use ZnZincStaticServerAdaptor but I can't get the behavior I want. > > When using > > > ZnZincStaticServerAdaptor startOn: 8080 andServeFilesFrom: (FileLocator imageDirectory / 'assets'). > > ZnZincStaticServerAdaptor default server debugMode: true. > > I have a super simple root component that renders fine. > > But if I call a non existent method I get a 404 'Not Found'. > > ZnSeasideServerAdaptorDelegate>handleRequest: znRequest > | response | > response := self adaptor process: znRequest. > ^ (response isError and: [ response isAuthenticationRequired not ]) > ifTrue: [ self staticDelegate handleRequest: znRequest ] > ifFalse: [ response ]. > > That explains the behavior. Is there a way to set a debugMode that does not trigger the fallback to the staticDelegate if the adaptor returns an error ? (opening a debugger would be great). ZnZincStaticServerAdaptor is really a hack as the #handleRequest: code clearly shows. I would suggest you make your own subclass that does what you want. I have never used ZnZincStaticServerAdaptor in practice. Right now I am very happy using standard Seaside FileLibraries during development and moving them to the filesystem during deploy (using, well, #deployFiles), with nginx in front handling them statically. Having a massive amount of static resources could be a counter indication. > Cheers, > Francois > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Ok. I've got quite a bit of external files, I'll roll my own ;) thanks ! _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
To serve static files from a directory during development, there still is the Seaside-Filesystem package.
-> Load the 'Filesystem' group from ConfigurationOfSeaside3 But I also do intend to replace it with serving static files from Zinc directly though. But, in the meantime, it's doing the job. Johan On 10 Apr 2014, at 08:39, François Stephany <[hidden email]> wrote: > Ok. I've got quite a bit of external files, I'll roll my own ;) > > thanks ! > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I quickly put this together: It will serve stuff placed in the assets directory (which must sit next to the image). Nothing really fancy but does the job: ZnSeasideStaticServerAdaptorDelegate subclass: #CCStaticServerDelegate instanceVariableNames: '' classVariableNames: '' category: 'Cocotte-Web' CCStaticServerDelegate>>handleRequest: znRequest znRequest url firstPathSegment = 'assets' ifTrue: [ znRequest url removeFirstPathSegment. "eats the /assets/" ^self staticDelegate handleRequest: znRequest ] ifFalse: [ ^self adaptor process: znRequest ] CCStaticServerDelegate>>initializeStaticDelegate | assetDirectory | assetDirectory := (FileLocator imageDirectory / 'assets'). ^ ZnStaticFileServerDelegate new directory: (ZnFileSystemUtils directory: assetDirectory) ; yourself ZnZincStaticServerAdaptor subclass: #CCZincStaticServerAdaptor instanceVariableNames: '' classVariableNames: '' category: 'Cocotte-Web' ZnZincStaticServerAdaptor>>defaultDelegate ^ CCStaticServerDelegate with: self On Sun, Apr 13, 2014 at 3:16 PM, Johan Brichau <[hidden email]> wrote: To serve static files from a directory during development, there still is the Seaside-Filesystem package. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Actually it works fine but I still doesn't have a debugger popping up in case of error. I still get a 500 page with the error message. This is how I start it: Any thing that I'm missing?CCZincStaticServerAdaptor startOn: 8080. CCZincStaticServerAdaptor default server debugMode: true. On Tue, Apr 15, 2014 at 6:06 PM, François Stephany <[hidden email]> wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi François,
I suspect you are confusing two aspects. Zinc can catch errors in its handler and report them in a user friendly page (standard behaviour) with the proper response code, or it can let the error through so that you end up in the debugger (debugMode: true) - see ZnSingleThreadedServer>>#handleRequestProtected: However, when using Seaside, all this is not necessary. Zinc is bit of overkill in this case, because Seaside wants to do more itself, including the error handling. In my image, this all works fine and as expected (as per the Seaside book / the standard instructions). You should have WAWalkbackErrorHandler as #exceptionHandler. Sven BTW, at first sight, your code looks OK to me. On 16 Apr 2014, at 10:55, François Stephany <[hidden email]> wrote: > Actually it works fine but I still doesn't have a debugger popping up in case of error. I still get a 500 page with the error message. This is how I start it: > > CCZincStaticServerAdaptor startOn: 8080. > CCZincStaticServerAdaptor default server debugMode: true. > > Any thing that I'm missing? > > > On Tue, Apr 15, 2014 at 6:06 PM, François Stephany <[hidden email]> wrote: > I quickly put this together: > It will serve stuff placed in the assets directory (which must sit next to the image). Nothing really fancy but does the job: > > ZnSeasideStaticServerAdaptorDelegate subclass: #CCStaticServerDelegate > instanceVariableNames: '' > classVariableNames: '' > category: 'Cocotte-Web' > > CCStaticServerDelegate>>handleRequest: znRequest > znRequest url firstPathSegment = 'assets' > ifTrue: [ > znRequest url removeFirstPathSegment. "eats the /assets/" > ^self staticDelegate handleRequest: znRequest ] > ifFalse: [ ^self adaptor process: znRequest ] > > CCStaticServerDelegate>>initializeStaticDelegate > | assetDirectory | > assetDirectory := (FileLocator imageDirectory / 'assets'). > ^ ZnStaticFileServerDelegate new > directory: (ZnFileSystemUtils directory: assetDirectory) ; > yourself > > And the Adaptor: > > ZnZincStaticServerAdaptor subclass: #CCZincStaticServerAdaptor > instanceVariableNames: '' > classVariableNames: '' > category: 'Cocotte-Web' > > ZnZincStaticServerAdaptor>>defaultDelegate > ^ CCStaticServerDelegate with: self > > > On Sun, Apr 13, 2014 at 3:16 PM, Johan Brichau <[hidden email]> wrote: > To serve static files from a directory during development, there still is the Seaside-Filesystem package. > -> Load the 'Filesystem' group from ConfigurationOfSeaside3 > > But I also do intend to replace it with serving static files from Zinc directly though. But, in the meantime, it's doing the job. > > Johan > > On 10 Apr 2014, at 08:39, François Stephany <[hidden email]> wrote: > > > Ok. I've got quite a bit of external files, I'll roll my own ;) > > > > thanks ! > > > > _______________________________________________ > > seaside mailing list > > [hidden email] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Oooh ok. You're right. This is seaside behaviour, nothing is related to Zinc: WAAdmin applicationExceptionHandlingDefaults at: #exceptionHandler "--> WAHtmlErrorHandler". I've registered WAWalkbackErrorHandler as the exception handler for my app and it is now working. Here's the simplest setting to make it work: CCRootComponent class>>initialize | app | super initialize. app := WAAdmin register: self asApplicationAt: 'my-super-app'. app exceptionHandler: WAWalkbackErrorHandler. Is the WAHtmlErrorHandler the new exception handler in Seaside or did I configure something wrong? Thanks a lot Sven :) On Wed, Apr 16, 2014 at 11:14 AM, Sven Van Caekenberghe <[hidden email]> wrote: Hi François, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On 17 Apr 2014, at 01:43, François Stephany <[hidden email]> wrote: > Is the WAHtmlErrorHandler the new exception handler in Seaside or did I configure something wrong? afaik, this has been the default in 3.0 as well Johan_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Johan Brichau-2
On 13 Apr 2014, at 15:16, Johan Brichau <[hidden email]> wrote: > To serve static files from a directory during development, there still is the Seaside-Filesystem package. > -> Load the 'Filesystem' group from ConfigurationOfSeaside3 Too bad that code is not using GRPlatform 'file library' methods, which would help its portability, right ? > But I also do intend to replace it with serving static files from Zinc directly though. But, in the meantime, it's doing the job. I actually think an all Seaside solution is somewhat preferable for portability. Speed wise, Zinc would help, serving the files directly with apache or nginx is way faster. Sven BTW: I seems to me that there is yet another option: a new subclass from WAAbstractFileLibrary that serves files from a directory. Should not be hard to do. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On 24 Apr 2014, at 15:01, Sven Van Caekenberghe <[hidden email]> wrote: > On 13 Apr 2014, at 15:16, Johan Brichau <[hidden email]> wrote: > >> To serve static files from a directory during development, there still is the Seaside-Filesystem package. >> -> Load the 'Filesystem' group from ConfigurationOfSeaside3 > > Too bad that code is not using GRPlatform 'file library' methods, which would help its portability, right ? You are right. There are indeed parts that would be better when they use Grease. There is also a dependency on Sport, which I think should be removed. >> But I also do intend to replace it with serving static files from Zinc directly though. But, in the meantime, it's doing the job. > > I actually think an all Seaside solution is somewhat preferable for portability. Speed wise, Zinc would help, serving the files directly with apache or nginx is way faster. When porting this library to Pharo3 and Seaside3.1, I had the idea to replace it with Zinc static file serving. However, I think you are right that an improved integration in Seaside of this package improves development. At least, we are using it and I tried replacing it but it always made things more complex. > BTW: I seems to me that there is yet another option: a new subclass from WAAbstractFileLibrary that serves files from a directory. Should not be hard to do. That is what the WAExternalFileLibrary is doing but it's not included in a project in the same way as a WAFileLibrary. So, if an external file library can be included in a project configuration, it would make development with external resources a lot simpler. Johan_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |