[ANN] a new lightweight web framework for GST

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[ANN] a new lightweight web framework for GST

Nicolas Petton
Hi,

I'm working since a few months on a small web framwork for GST named
Iliad.

Now, I think it could be useful to others, so I wanted to share the
code.

The framework uses pieces of code from other frameworks like Seaside and
HttpView2 and has the following features:

- Widgets: Stateful objects very similar to Seaside components with
block closure actions and show/answer

- Applications: special widgets which know how to dispatch a request,
you can see it as a root component, but with view methods.

- Fully ajaxified: Each widget is fully ajaxified, but it degrades
nicely when javascript is disabled, so the behaviour is exactly the same

if you are interested, here's a quick start:

svn co http://bioskop.fr/svn/gst/iliad iliad
cd iliad
gst-package -t ~/.st ./Core/package.xml
gst-package -t ~/.st ./Swazoo/package.xml
gst-package -t ~/.st ./More/Widgets/package.xml
gst-package -t ~/.st ./More/Magritte/package.xml
gst-package -t ~/.st ./More/Examples/package.xml
gst-package -t ~/.st ./package.xml

gst
>> PackageLoader fileInPackage: 'Iliad'
>> Iliad.SwazooIliad startOn: 7777
>> Processor activeProcess suspend

And go to http://localhost:7777/examples/counters/multicounter to see
the counter example.

The doc is almost inexistent, but I'll be happy to answer questions.
There are some comments in the code, in particular be sure to read
comments it:

- Core/Builders/Application.st
- Core/Builders/Widget.st

There is also a Redmine website at: http://iliad.bioskop.fr

If you encounter issues with Swazoo, be sure to load the latest port
from GST git.

Cheers!

Nico



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Stefan Schmiedl
That's unfair, Nicolas.

Just when I have _absolutely_ no time for messing around,
you publish such a nifty thing.

On Tue, 16 Jun 2009 17:13:47 +0200
Nicolas Petton <[hidden email]> wrote:

> if you are interested, here's a quick start:
>
> svn co http://bioskop.fr/svn/gst/iliad iliad
> cd iliad
> gst-package -t ~/.st ./Core/package.xml
> gst-package -t ~/.st ./Swazoo/package.xml
> gst-package -t ~/.st ./More/Widgets/package.xml
> gst-package -t ~/.st ./More/Magritte/package.xml
> gst-package -t ~/.st ./More/Examples/package.xml

also:
  gst-package -t ~/.st ./More/package.xml

> gst-package -t ~/.st ./package.xml
>
> gst
> >> PackageLoader fileInPackage: 'Iliad'
> >> Iliad.SwazooIliad startOn: 7777
> >> Processor activeProcess suspend
>
> And go to http://localhost:7777/examples/counters/multicounter to see
> the counter example.

Very nice ... readable URL, no backbutton ...

But, alas, I have to get back to work.

"I'll be back."
s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
Le mardi 16 juin 2009 à 18:13 +0200, Stefan Schmiedl a écrit :
> That's unfair, Nicolas.
>
> Just when I have _absolutely_ no time for messing around,
> you publish such a nifty thing.

Hehe, sorry!

The good news is that the code will still be available when you'll have
some time ;)

Cheers!

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Stefan Schmiedl
On Tue, 16 Jun 2009 18:22:52 +0200
Nicolas Petton <[hidden email]> wrote:

> Le mardi 16 juin 2009 à 18:13 +0200, Stefan Schmiedl a écrit :
> > That's unfair, Nicolas.
> >
> > Just when I have _absolutely_ no time for messing around,
> > you publish such a nifty thing.
>
> Hehe, sorry!
>
> The good news is that the code will still be available when you'll
> have some time ;)
>

Now look what I did ...

$ for a in Core Swazoo More/Widgets More/Magritte More/Examples More . ; do gst-package -t ~/.st $a/package.xml ; done
$ gst -i
st> PackageLoader fileInPackage: 'Iliad'
st> Iliad.SwazooIliad startOn: 7777
st> ObjectMemory snapshot: 'iliad.im'
$ gst-remote --daemon -I ./iliad.im

and it still works :-D

Next I should add a thingie to the counter page for saving the image,
but I've still no time for messing with Iliad as it deserved to be
messed with,
s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

MrGwen
In reply to this post by Nicolas Petton
On Tuesday 16 June 2009 17:13:47 Nicolas Petton wrote:

Hi Nicolas,

Congratulation you've made a fantastic work ;)

Cheers,
Gwenael


--

GtkLauncher for GNU Smalltalk : http://gtklauncher.bioskop.fr/


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
Le mercredi 17 juin 2009 à 11:53 +0200, Gwenael Casaccio a écrit :
> On Tuesday 16 June 2009 17:13:47 Nicolas Petton wrote:
>
> Hi Nicolas,
>
> Congratulation you've made a fantastic work ;)

Thank you very much :)

Cheers!

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Joachim Jaeckel
In reply to this post by Nicolas Petton
Hello Nicolas.

I'm sorry, because maybe this is a dumb question... but how do I start
my brand new application?

This is my current code to see only a realy easy application:

Iliad.Application subclass: UrPicsApplication [

     UrPicsApplication class >> path [
         ^'/urpics'
     ]

     updatePage [
         super updatePage.
         self page headElement title: 'UrPics - show your pictures!'.
         self page headElement stylesheet href: '/resources/style.css'.
     ]

     index [
         ^[ :e |
             e add: UnknownHome new build
         ]
     ]

]

Iliad.Widget subclass: UnknownHome [

     contents [
         ^[ :e |
             e h1: 'UrPics - show your pictures!'.
         ]
     ]

]

The examples are accessible and running, but what do I have to do, to
"install" my application? (And make it accessible through the wished
path? I get only a 404 Not Found: /urpics.

Thanks in advance,
Joachim.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
Hi Joachim,

Your application is in fact running. You don't have to do anything to
make your application available, as long as it has a path.

The problem you encounter is that your application dispatchs the
request, but return a 404 error, because there is no view method in your
application.

The #index method should be the default view method, but its category
isn't 'views', so it isn't.  This may look a bit odd, but take a look at
Iliad.Application class >> selectorFilter and #defaultSelectorFilter,
you may understand it better.

By default, only methods in the 'views' protocol can be used as view
methods, so the fix here is very simple:

index [
        <category: 'views'>
        ^[:e |
                e add: UnknownHome new build]
]

If you want, you can supply your own selectorFilter block and override
#dispatchOverride (see #dispatch method comment for more infos).

HTH,

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Paolo Bonzini-2
> If you want, you can supply your own selectorFilter block and override
> #dispatchOverride (see #dispatch method comment for more infos).

Looking at Joachim's code I'm even more amazed by Iliad, but this
screams for a quick HOWTO... please!

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
Le vendredi 19 juin 2009 à 12:55 +0200, Paolo Bonzini a écrit :
> > If you want, you can supply your own selectorFilter block and override
> > #dispatchOverride (see #dispatch method comment for more infos).
>
> Looking at Joachim's code I'm even more amazed by Iliad

Thanks Paolo!

> , but this
> screams for a quick HOWTO... please!

I started to write one. I'll post it on gst blog as soon as it will be
ready ;)

Cheers!

Nico

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Joachim Jaeckel
In reply to this post by Nicolas Petton
Hi Nicolas,

I'm sorry, but I think that I miss something in my code. Even with the
index-method in the right category, I couldn't reach my "application"
(big word for a 5-liner ;-) through http://localhost:7777/urpics.

In seaside for instance, I have to do additionally a:
#registerAsApplication and I would think, that I miss something here.

Only with loading the classes into the vm, while swazoo is running,
could that be all...? (I don't think so...)

Regards,
Joachim.

P.S.: I could help, writing something like a small tutorial (if you'd
like), but I have to understand a bit more of it first.

Nicolas Petton schrieb:

> Hi Joachim,
>
> Your application is in fact running. You don't have to do anything to
> make your application available, as long as it has a path.
>
> The problem you encounter is that your application dispatchs the
> request, but return a 404 error, because there is no view method in your
> application.
>
> The #index method should be the default view method, but its category
> isn't 'views', so it isn't.  This may look a bit odd, but take a look at
> Iliad.Application class >> selectorFilter and #defaultSelectorFilter,
> you may understand it better.
>
> By default, only methods in the 'views' protocol can be used as view
> methods, so the fix here is very simple:
>
> index [
> <category: 'views'>
> ^[:e |
> e add: UnknownHome new build]
> ]
>
> If you want, you can supply your own selectorFilter block and override
> #dispatchOverride (see #dispatch method comment for more infos).
>
> HTH,
>
> Nico



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Paolo Bonzini-3
Joachim Jaeckel wrote:

> Hi Nicolas,
>
> I'm sorry, but I think that I miss something in my code. Even with the
> index-method in the right category, I couldn't reach my "application"
> (big word for a 5-liner ;-) through http://localhost:7777/urpics.
>
> In seaside for instance, I have to do additionally a:
> #registerAsApplication and I would think, that I miss something here.
>
> Only with loading the classes into the vm, while swazoo is running,
> could that be all...? (I don't think so...)

I haven't played with Iliad yet but I don't see why not (Application
allSubclasses...)

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Joachim Jaeckel
In reply to this post by Joachim Jaeckel
Ok, I got it... don't know why at the moment.

My yesterdays tries where with gst-remote and a configured image, with a
running swazoo already. (As described by Stefan.)

Now I tried it with the method, described in your first mail about the
framework... (with gst)...

(And even with gst-remote, with stopping and restarting Swazoo, the
application is not shown...

Maybe you know (with a deeper knowledge of you framework) what's the
difference between both methods?

Regards,
Joachim.



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Paolo Bonzini-3
Joachim Jaeckel wrote:

> Ok, I got it... don't know why at the moment.
>
> My yesterdays tries where with gst-remote and a configured image, with a
> running swazoo already. (As described by Stefan.)
>
> Now I tried it with the method, described in your first mail about the
> framework... (with gst)...
>
> (And even with gst-remote, with stopping and restarting Swazoo, the
> application is not shown...
>
> Maybe you know (with a deeper knowledge of you framework) what's the
> difference between both methods?

A bug in gst-remote? ;-)

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
In reply to this post by Joachim Jaeckel
Le vendredi 19 juin 2009 à 13:39 +0200, Joachim Jaeckel a écrit :
> Hi Nicolas,
>
> I'm sorry, but I think that I miss something in my code. Even with the
> index-method in the right category, I couldn't reach my "application"
> (big word for a 5-liner ;-) through http://localhost:7777/urpics.
>
> In seaside for instance, I have to do additionally a:
> #registerAsApplication and I would think, that I miss something here.

Nop, there is no registration needed in Iliad.

>
> Only with loading the classes into the vm, while swazoo is running,
> could that be all...? (I don't think so...)

Yes, that's all!

The followiing works for me:

PackageLoader fileInPackage: 'Iliad'
FileStream fileIn: 'UrPicsApplication.st' "file is attached to this
email"
Iliad.SwazooIliad startOn: 7777
Processor activeProcess suspend


Then the app is available at: http://localhost:7777/urpics

>
> P.S.: I could help, writing something like a small tutorial (if you'd
> like), but I have to understand a bit more of it first.

Yes, that would be wonderful :)


Cheers!

Nicolas

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

UrPicsApplication.st (746 bytes) Download Attachment
signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Nicolas Petton
In reply to this post by Paolo Bonzini-3
Le vendredi 19 juin 2009 à 14:05 +0200, Paolo Bonzini a écrit :

> Joachim Jaeckel wrote:
> > Ok, I got it... don't know why at the moment.
> >
> > My yesterdays tries where with gst-remote and a configured image, with a
> > running swazoo already. (As described by Stefan.)
> >
> > Now I tried it with the method, described in your first mail about the
> > framework... (with gst)...
> >
> > (And even with gst-remote, with stopping and restarting Swazoo, the
> > application is not shown...
> >
> > Maybe you know (with a deeper knowledge of you framework) what's the
> > difference between both methods?
>
> A bug in gst-remote? ;-)
That's possible, because I don't know why it should make a difference...

Nico
>
> Paolo
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Joachim Jaeckel
In reply to this post by Paolo Bonzini-3
Hi!

> A bug in gst-remote? ;-)

Oh... *sad* I was sooooo happy, that gst-remote was running on my
computer after your described patch for amd64.

(But nevertheless, I discovered some differences between gst and
gst-remote, e.g. the order is very important for gst-remote in which you
load the several files into the vm. Otherwise, gst-remote will print out
warnings about not existent classes.)

Joachim.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Stefan Schmiedl
Not only do you start eminently interesting and possibly
highly important things when I have no time to play, you
also are mailing faster than I can keep up with checking
things on my box...

On Fri, 19 Jun 2009 14:11:23 +0200
Joachim Jaeckel <[hidden email]> wrote:

> (But nevertheless, I discovered some differences between gst and
> gst-remote, e.g. the order is very important for gst-remote in which
> you load the several files into the vm. Otherwise, gst-remote will
> print out warnings about not existent classes.)

That is true ... I had to put UnknownHome in front of
UrPicsApplication.

It might be a clue to where the problem is, though.
What, if the filed in class definition are handled
in a way that the code does not end up where we expect
it to?

$ gst -I iliad.im jj.st -
GNU Smalltalk ready

st> Processor activeProcess suspend
^C
st> Iliad.Application categoryOfElement: #index inClassOrSuperclass: UrPicsApplication
'views'
st>

$ gst-remote --server -f jj.st -I iliad.im
$ gst-remote -e "(Iliad.Application categoryOfElement: #index inClassOrSuperclass: UrPicsApplication) printNl"
'still unclassified'

ho hum ...

s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] a new lightweight web framework for GST

Paolo Bonzini-3

>> (But nevertheless, I discovered some differences between gst and
>> gst-remote, e.g. the order is very important for gst-remote in which
>> you load the several files into the vm. Otherwise, gst-remote will
>> print out warnings about not existent classes.)
>
> It might be a clue to where the problem is, though.

Indeed.  gst uses the builtin compiler (written in C), while gst-remote
uses the Parser and Compiler packages.

Stephen Compall would be the right person to look into it (he was the
one stress-testing the Smalltalk compiler to the point that it became
usable for gst-remote), but he's not been active for a while.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

gst-remote architecture

Stefan Schmiedl
In reply to this post by Joachim Jaeckel
On Fri, 19 Jun 2009 14:11:23 +0200
Joachim Jaeckel <[hidden email]> wrote:

> > A bug in gst-remote? ;-)
>
> Oh... *sad* I was sooooo happy, that gst-remote was running on my
> computer after your described patch for amd64.

I can make a ruby script remote-able by including the
drb-library and starting the server. Is it possible for
gst to take the same approach, i.e. _just_ file in some
Smalltalk code?

Why do we need a dedicated gst-remote binary?

Curious,
s.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
12