🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Some Experimentation

posted in Rarely Spoken
Published November 28, 2006
Advertisement
Just a short bit of what I've been playing with recently.

I still work on my CMS off and on and recently I've been experimenting with REST. In my old design each module had a function called GetContent() which would be passed an array of POST variables and an array of parameters coming from the URI. The problem with this design is that I needed to do all my form processing in some large and nasty function which basically left me unsatisfied with my entire system. I also ran into some chicken-vs.-egg problems when installing modules.

This is my new system:

I've gotten rid of the GetContent() function. Instead, during installation, modules can register handlers for specific HTTP methods on given URIs. For example, my administration module registers a handler for GET on /members/*, /modules/, PUT on /widgets/, and DELETE on /members/* (among other things). GET on /members/ will get a page listing the registered members on my site. You can be more specific and GET /members/Colin%20Jeanne/ and it will get my profile. PUT on /widgets/ will change the display order of the widgets. DELETE on /members/Colin%20Jeanne/ will delete my user account.

Each URI/HTTP method pair is associated with a callback function which handles it and is passed the rest of the URI as extra parameters. For example, GET on /members/Colin%20Jeanne/ is handled by the function that handles all GETs on /members/* and "Colin Jeanne" is the parameter of the function.

I like this system by there are some kinks to work out. Firstly, I like the use of PUT and DELETE but these seem difficult to use in HTML forms - PUT especially. I would like to have the content of a PUT message be an XML fragment but HTML forms dont really allow me to specify what is sent. I could easily set it up in &#106avascript but I'd like my site to also work for users with &#106avascript turned off.<br><br>Hmmm... I'll definitely need to experiment more during winter break.<div> </div>
Previous Entry 4E5
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

4E6 PyGame

1382 views

4E5

1116 views

Happy Yesterday!

1071 views

Another Game

1278 views

Merry Christmas!

1052 views

Hello There

1051 views

Yay!

1066 views
Advertisement