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 javascript but I'd like my site to also work for users with javascript turned off.<br><br>Hmmm... I'll definitely need to experiment more during winter break.<div>
</div>
🎉 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!
Advertisement
Latest Entries
4E6 PyGame
1382 views
The 4e6 Adventure! (Help)
1190 views
Some Experimentation
961 views
4E5
1116 views
Happy Yesterday!
1071 views
Another Game
1278 views
Merry Christmas!
1052 views
Hello There
1051 views
Creating A BBCode System
1413 views
Yay!
1066 views
Advertisement