REST-style URLs and HTTP actions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

REST-style URLs and HTTP actions

Henrik Pettersen
All,

I was just in the middle of creating a few pages for my application,
when I started thinking about REST-style URLs and HTTP Actions. It
seems to me that I am creating several pages/urls that look like this:

/query/add
/query/delete
/query
/query/save

which is not exactly what you would want in a document centric URL schema.

Now, you allready have the option of specifying the HTTP action in the
submission definition in your view (get, post, put, delete). What if
you allowed to specify and match on this action in the pageflow, as
well:

    <page path-info="/query"
          id="query"
          view="oxf:/query/view/all.queries.xsl"
          model="oxf:/query/service/get.all.queries.xpl"
          http-action="get">
    </page>

    <page path-info="/query"
          id="query"
          view="oxf:/query/view/all.queries.xsl"
          model="oxf:/query/service/delete.query.xpl"
          http-action="delete">
    </page>

    <page path-info="/query"
          id="query"
          view="oxf:/query/view/all.queries.xsl"
          model="oxf:/query/service/create.query.xpl"
          http-action="post">
    </page>

    <page path-info="/query"
          id="query"
          view="oxf:/query/view/all.queries.xsl"
          model="oxf:/query/service/update.query.xpl"
          http-action="put">
    </page>

Another alternative would also be to include the CRUD action you are
trying to achieve in the instance itself, using an <action> element or
something similar. However, I think this leads to rather more messy
looking pageflow definitions.

Just my 2 cents :-) What do you all think?

Here is more on REST and URL naming schemas:
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

Henrik Pettersen
Advanced Computation Laboratory
Cancer Research UK



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: REST-style URLs and HTTP actions

Erik Bruchez
Administrator
Henrik,

 > Now, you allready have the option of specifying the HTTP action in the
 > submission definition in your view (get, post, put, delete). What if
 > you allowed to specify and match on this action in the pageflow, as
 > well:

I think the general idea makes perfect sense. Right now the PFC is not
really tailored to make it super-easy to implement REST services.

 > Another alternative would also be to include the CRUD action you are
 > trying to achieve in the instance itself, using an <action> element
 > or something similar. However, I think this leads to rather more
 > messy looking pageflow definitions.

Yes, and I don't like it! A better way is to implement all the HTTP
methods in an XPL file, based on the method read using oxf:request.

-Erik

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws