#124 closed todo (done)

url configuration for uwiki

Reported by: Mridul Owned by: Mridul
Priority: normal Milestone:
Component: uwiki Keywords:
Sub Tickets: Parent Tickets:

Description

we need generic style urls for the uwiki system.

I propose these url schemes:

1.

domain/action-name/params

where action-name can point to a script file and arguments can be supplied using parameters.

Example: (these are only examples, links not implemented yet!)

http://uwiki.lumiera.org/edit-page/gui/using-timeline

will call the action "edit-page" which will edit a page under "gui" category with name "using-timeline"

2.

domain/controller/action/params

where controller is the script containing many actions as functions.

Examples:

http://uwiki.lumiera.org/page/edit/gui/using-timeline

this will run a script called page which has many functions like edit, create, view, delete etc.

or

http://uwiki.lumiera.org/user/edit/user-id=5

this will run script user which has many functions such as add, edit, remove, allow etc.

We've to decide which one's better.

2nd scheme's implementation is tougher and it might be language dependent (maybe some Reflection system is reqd to call functions). But this is the default scheme used by many web frameworks like Ruby on Rails and cakePHP etc.

Change history (4)

in reply to:  description comment:1 by Christian Thäter, at 2009-06-02T03:49:39Z

Replying to mridkash:

we need generic style urls for the uwiki system.

I propose these url schemes:

1.

domain/action-name/params

where action-name can point to a script file and arguments can be supplied using parameters.

Example: (these are only examples, links not implemented yet!)

http://uwiki.lumiera.org/edit-page/gui/using-timeline

will call the action "edit-page" which will edit a page under "gui" category with name "using-timeline"

2.

domain/controller/action/params

where controller is the script containing many actions as functions.

Examples:

http://uwiki.lumiera.org/page/edit/gui/using-timeline

this will run a script called page which has many functions like edit, create, view, delete etc.

or

http://uwiki.lumiera.org/user/edit/user-id=5

this will run script user which has many functions such as add, edit, remove, allow etc.

We've to decide which one's better.

My initial idea was to use PATH_INFO only to pass the actual file path around and pass any parameters like normal cgi parameters, either in the url: /foo/bar?param=baz or preferable as POST (any request should work transparently with POST and GET if possible where POST is default, but thats already the case, no need to discuss I think)

Now the problem is, how to disabiguate actions from static pages, currently we configured uwiki to be in cgi-bin, a url then looks like http://localhost/cgi-bin/uwiki.cgi/action/path/to/file?parameters... At some point we may want to hide the cgi-bin/uwiki.cgi/ part. But this needs to be well defined not to conflict with potential existing pages. A name with a leading underscore comes in mind here, since these are reserved in uwiki, unfortunally http://localhost/_uwiki/ is already taken for the uwiki system itself as static content. Any idea? http://localhost/_uwiki_action/edit/path/to/file?parameters...?

comment:2 by Mridul, at 2009-06-02T05:06:12Z

I've rewritten the urls in server config and now try visiting http://uwiki.pipapo.org/ to see the uwiki live.

Apache transforms this url to the complete form internally and I've supplied this regex to the rewrite module.

RewriteRule (.*)$ to -> /cgi-bin/cgilua.cgi/uwiki.lua/$1

So now anything you type after uwiki.pipapo.org/ will be regarded as an action. Try create, account etc

comment:3 by Mridul, at 2009-06-02T06:05:47Z

all dynamic pages are now prefixed with _uwiki_

and rest of the pages are served statically.

Example: domain/_uwiki_create points to create action and domain/page.html loads a simple html page

comment:4 by Mridul, at 2009-08-11T20:44:02Z

Resolution: done
Status: newclosed

the way action names are being extracted from url is this,
url: domain/cgi-bin/uwiki/test/
path_info: /test/
actionname: test (after running a regex)

However, I find this scheme not much fit for web, as urls can be like domain/cgi-bin/uwiki/test?bla&bla where the regex solution fails. Notice the missing /

I propose going by standards and using url to point at real files and using query strings for actions, like

domain/cgi-bin/uwiki?action=test

domain/cgi-bin/uwiki/path/to/file.html?action=edit&params=foo

domain/cgi-bin/uwiki?action=login&username=mk&foo=bar

this style also makes sense to the one who reads it.

closing this ticket now, reopen if you disagree.

Note: See TracTickets for help on using tickets.