VASmalltalk – Simple REST GET framework

I needed a playground for a simple REST GET based framework.

I converted the code from Seaside-REST from Squeak to VASmalltalk – but after one day of work I stopped the work on that, because several SUNIT tests were failing and to fix that it was needed to full understand that framework code – but though the approach looked quite interesting it seems for me to be too difficult at the beginning. Perhaps I’ll put additional hours in the future to finish the port.

Another idea I got after reading that code: is all that pragma stuff really that useful !? I am not sure about that !? I’ve not seen yet a useful example for pragma statements in Smalltalk code …

I started again this morning and after three hours I got my playground code for REST GET stuff – you may download the code “MSKSeasideSimpleREST” from vastgoodies.

There is an application included showing a simple example and on the application class class side you will find some addition documentation.

Here’s how to create your own REST GET service:

* Generate a subclass of MSKGeneralRESTInterpreter. This class should be used to handle all incoming requests for this service

* Register your service via (use MSKRESTRequestHandler for an initial request handler class) and give it a name

registerMSKSimpleREST: MSKRESTRequestHandler
with: 'plusrest'
interpreter: MSKExampleAdditionRESTInterpreter

* now create the method #generateRegisteredActions in your subclass of MSKGeneralRESTInterpreter. Have a look at class MSKExampleAdditionRESTInterpreter how this might look like …

* Whenever you change the generateRegisteredActions method you should reregister your service …

You may test the example code with your local Seaside server:

Have fun …. and please remember this code is playground code and it will be changed in the future …

This entry was posted in Smalltalk. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s