On 2 Mar 2010, at 16:33, Ross Gardler wrote:

On 02/03/2010 13:40, Raido Kuli wrote:
I got it going.My problem, was for both cases, wrong widgetid parameter value.

I made that mistake a few times. I think they are confusingly named. There are a number of "id" parameters, the use of each is not very obvious and I didn't find the javadocs to be a great deal of help.

This is another area I think we can improve the code a fair bit. It always takes new eyes like ours to uncover these kinds of issues, those working with the code for any length of time will have the different IDs etched into their minds.

Yes, it makes sense inside Wookie, but how these are exposed in the representations of Widget and WidgetInstance in XML doesn't really help.

Here's a widget:

<?xml version="1.0" encoding="UTF-8"?>
<widgets>
<widget id="3" identifier="http://www.getwookie.org/widgets/todo"; width="320" height="460" version="">
                <title short="">Ta-Da!</title>
                <description>A shared to-do list widget</description>
<icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png </icon>
                <author>Apache Wookie (Incubating) Team</author>
        </widget>
</widgets>

As you can see there is:

widget.id = the internal id used for the widget (i.e. its database key)
widget.identifier = the external IRI used to globally identify the widget. (In the code this is sometimes called the widget guid. In W3C Widgets this is called the widget id attribute).

A request for information about the widget uses widget.id, e.g.

GET /wookie/widgets/3

A request for a new widget instance uses widget identifier, e.g.

POST /wookie/widgetinstances
        api_key=TEST
        userid=test
        shareddatakey=test
        widgetid=http://www.getwookie.org/widgets/todo

Here's a widget instance:
<?xml version="1.0" encoding="UTF-8"?>
<widgetdata>      
<url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D </url> <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
        <title>Ta-Da!</title>
        <height>460</height>
        <width>320</width>
        <maximize>false</maximize>
</widgetdata>

widgetinstance.identifier = the hash of the widget instance composite key (same as idkey param in widgetinstance.url)

So not very consistent unfortunately.

The representations of all objects are created by classes in the org.apache.wookie.helper package - you could also extend these, for example, to produce alternate representations using JSON as well as XML, and to tweak the output to be more consistent and obvious.




Ross

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to