Mailinglist Archive: yast-devel (163 mails)

< Previous Next >
[yast-devel] rest-service ResourcesController should be more RESTful
  • From: Martin Kudlvasr <mkudlvasr@xxxxxxx>
  • Date: Thu, 17 Sep 2009 15:35:53 +0200
  • Message-id: <200909171535.53748.mkudlvasr@xxxxxxx>

see for introduction.

Basically, we currently discover resources from interface using path like:

this is not restful, so service_resource.rb circumvents this by always using
"proxy.find :all" and then searching for the resource in the list
(/resources.xml works well). Simply because "proxy.find
''" does not work ("proxy" is a proxy
for /resources).

Goal: Make it work!
Currently finding a single resource is not used, so we have a bit of freedom,
when figuring that out. There are 2 problems:


/resources/ is a problematic path,
because "." is a format separator (for .xml, .json, ...).

proposed solution:

use dashes instead of dots in the URI.
We can say, that dashes cannot be part of interface name (thanks to mvidner
names). The interface name has to be transliterated, but this happens only
once on server and once on client.


there can be more resources found for a single interface name. In current
implementation, ResourcesController returns this for /resources.xml:

and the same format for
/resources.xml? . Returning a
list of items, where (according to ActiveResource) a single item is expected.
ActiveResource has a problem with that.

**imho optimal solution:**

remake the xml format, so that single resource can contain several
implementations (the same way it is in internal structures of rest-
service/webservice/lib/resource_registration.rb). The format for
/resources.xml can then look like this:


with the same (but only single <resource>) for /resources/$interface_name.xml
. By remaking the xml, service_resource.rb would have to be changed. I tried
that and did not succeed.

**proposed solution:**

Make server return only single implementation/resource, when asked for a
single interface.
This would preserve current format of /resources.xml and work with
ActiveResource mechanisms at the same time. The only thing that changes is,
that server decides which implementation of resource is used by the client.
Until now, this was decided in web-client by the rule "take first"

Both proposed solutions are implemented in resource-restful branch and pushed
to Please comment, if this can be merged, and say why, if

Martin Kudlvasr
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages