[uf-rest] Fwd: [microformats-discuss] REX! Re: REST-discuss list,
naming
toydi
iamstupidiot at gmail.com
Mon Oct 31 18:13:15 PST 2005
Hi all, I would like to share some of my experience regarding
browser's limitations.
> 1. Constraining REST verbs to POST/GET
[Case]
I built a simple web app recently in order to gain some REST
experiences. The app's main target user agent is browser, and I faced
two problems:
1) To send out HTTP requests other than GET, POST, script
(xmlhttprequest) is the only solution. What if some end-users fail to
turn on the scripting support in their browsers?
2) Some browsers still having problems to correctly send out desired
HTTP request (e.g Opera8 can't send out PUT, DELETE, IE6 having
problem to send out DELETE to URL which require HTTP-digest-auth).
[Problems]
My web app need to provide services: 1) friendly enough for both
script-enabled and script-disabled browsers, 2) and also *rich
semantic* enough for other *powerful* user agents.
[Solution]
As a results, I try to make use of the "client-server" constraint [1]
to come out with a solution by separating out UI from the app's main
functionality.
"App functionality resources" accept complete HTTP requests (e.g GET,
PUT, POST, DELETE) to allow usual RESTful manipulation of resources.
"UI resources" (just some HTML Form pages) armed with scripts, allow
end-user to send out HTTP request directly to any "App functionality
resources".
In addition, the "UI resource" itself, also accepts POST request (in
case script failed), uses the received form-data to reconstruct an
internal request, then internally forwards it to the target "App
functionality resource".
[Example]
Well, here's some pictures (I always prefer pictures ;-) ) to show an
example on how to update an Announcement resource in my app:
Script-Enabled Scenario
(http://restylab.php5.cz/files/images/script-enabled-scenario.gif)
Script-Disabled Scenario
(http://restylab.php5.cz/files/images/script-disabled-scenario.gif)
With the separation of UI and functionality resources, the app now,
can serve well to various user agents including both script-enabled &
script-disabled browsers.
Any comments?
[1] http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_2
Cheers,
--
-toydi-
More information about the microformats-rest
mailing list