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


WAAdmin
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:

http://127.0.0.1/plusrest/plus/1.0/2.0/3.0/4.5

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

Advertisement
This entry was posted in Smalltalk. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.