Simplifying web form programming with more savvy URI forms
Before I went to bed last night, I brainstormed for a while and came up with a nice little standard form for web application URIs - for refering to forms, actions, and for static files - that I think will make creating sites easier.
URI format that simplifies creation of interactive web pages
Standard (STD) URI forms:
STD "object/action" URI
/ [webapp-context-name] / [object-type] / [object-id] / [object-action]
Examples of object-action: view [default], edit, delete
Note: destructive actions like delete should be performed via POST - not GET, so that they cannot be bookmarked.
STD "object/resource" URI
/ [webapp-context-name] / [object-type] / [object-id] / [object-type] / [object-resource-id]
Examples of object-resource-id: icon.jpg, portrait.png, thumbnail.gif, controlPanelApplet.jar, statusBarApplet.jar
STD "system/action" URI
/ [webapp-context-name] / [system-action]
Examples: login; where [system-action] = "login" OR logout; where [system-action] = "logout"
STD "system/resource" URI
/ [webapp-context-name] / [object-type] / [system-resource-id]
Examples: Logo for system; where [object-type] = "image", [system-resource-id] = "logo.gif"
OR Favicon for web site where [object-type] = "image", [system-resource-id] = "favicon.ico"
Rationales:
1. This lets web pages, which tend to be focussed on a subject after all, use relative URIs for things that are part of that subject, and absolute URIs for things that should be part of the system as a whole. A concrete example of this would be images, but it could be background music wave or MIDI files, downloadable content, etc.
2. It also makes it easier to navigate from one page to another within the context of the same subject. So, getting from a view page to an edit page would be quite simple. You would just specify edit in the action attribute for the form.
URI format that simplifies creation of interactive web pages
Standard (STD) URI forms:
STD "object/action" URI
/ [webapp-context-name] / [object-type] / [object-id] / [object-action]
Examples of object-action: view [default], edit, delete
Note: destructive actions like delete should be performed via POST - not GET, so that they cannot be bookmarked.
STD "object/resource" URI
/ [webapp-context-name] / [object-type] / [object-id] / [object-type] / [object-resource-id]
Examples of object-resource-id: icon.jpg, portrait.png, thumbnail.gif, controlPanelApplet.jar, statusBarApplet.jar
STD "system/action" URI
/ [webapp-context-name] / [system-action]
Examples: login; where [system-action] = "login" OR logout; where [system-action] = "logout"
STD "system/resource" URI
/ [webapp-context-name] / [object-type] / [system-resource-id]
Examples: Logo for system; where [object-type] = "image", [system-resource-id] = "logo.gif"
OR Favicon for web site where [object-type] = "image", [system-resource-id] = "favicon.ico"
Rationales:
1. This lets web pages, which tend to be focussed on a subject after all, use relative URIs for things that are part of that subject, and absolute URIs for things that should be part of the system as a whole. A concrete example of this would be images, but it could be background music wave or MIDI files, downloadable content, etc.
2. It also makes it easier to navigate from one page to another within the context of the same subject. So, getting from a view page to an edit page would be quite simple. You would just specify edit in the action attribute for the form.
0 Comments:
Post a Comment
<< Home