RE: Issues in WADL stylesheet when referencing faults or methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: Issues in WADL stylesheet when referencing faults or methods

Webb, Douglas

I'm having the same problem, and if it helps I'll describe the use case
I'm working with. One of my resource types allows resources to be
identified under three different URI templates. I don't want to have to
repeat the entire resource definition for each URI, so I'm using the
same type attribute on three different resource elements, each of which
has a different path attribute and different param children.

eg:

<resource path="root">
    <resource path="first/{firstcode}" type="mytype">
        <param name="firstcode" style="template"/>
    </resource>
    <resource path="second/{secondcode}" type="mytype">
        <param name="secondcode" style="template"/>
    </resource>
    <resource path="third/{thirdcode}" type="mytype">
        <param name="thirdcode" style="template"/>
    </resource>
</resource>

<resource_type id="mytype">
    ...
</resource_type>


This should allow a particular resource, whose type is "mytype", to be
available under /root/first/abc, /root/second/123, and /root/third/xyz,
assuming that the service understands that all three refer to the same
resource. Other resources in my system will link to "mytype" resources
using whichever URI is most convienient/available.

Thanks for your help!

Douglas Webb



Reply | Threaded
Open this post in threaded view
|

Re: Issues in WADL stylesheet when referencing faults or methods

Marc Hadley

The values of the type attributes are URIs, in the case below you need  
type="#mytype" instead of type="mytype" - i.e. a fragment identifier  
for a resource_type element in the same document.

Does that help ?

Marc.

On Jan 26, 2009, at 1:06 PM, Webb, Douglas wrote:

>
> I'm having the same problem, and if it helps I'll describe the use  
> case
> I'm working with. One of my resource types allows resources to be
> identified under three different URI templates. I don't want to have  
> to
> repeat the entire resource definition for each URI, so I'm using the
> same type attribute on three different resource elements, each of  
> which
> has a different path attribute and different param children.
>
> eg:
>
> <resource path="root">
>    <resource path="first/{firstcode}" type="mytype">
>        <param name="firstcode" style="template"/>
>    </resource>
>    <resource path="second/{secondcode}" type="mytype">
>        <param name="secondcode" style="template"/>
>    </resource>
>    <resource path="third/{thirdcode}" type="mytype">
>        <param name="thirdcode" style="template"/>
>    </resource>
> </resource>
>
> <resource_type id="mytype">
>    ...
> </resource_type>
>
>
> This should allow a particular resource, whose type is "mytype", to be
> available under /root/first/abc, /root/second/123, and /root/third/
> xyz,
> assuming that the service understands that all three refer to the same
> resource. Other resources in my system will link to "mytype" resources
> using whichever URI is most convienient/available.
>
> Thanks for your help!
>
> Douglas Webb
>
>
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.



Reply | Threaded
Open this post in threaded view
|

RE: Issues in WADL stylesheet when referencing faults or methods

Webb, Douglas

That helped tons; thanks. I actually figured that out myself from
reading the xslt file.

I'm having a different problem now, though, which I think may be related
to the way you copy referenced resource_types and methods. First, I was
using namespaces on my ids, which I don't think your xslt handles
because it's adding a namespace too. I removed them because the Yahoo
example doesn't have them. This hasn't solved my problem, though.

Given my example below, I would expect the documentation for the
"mytype" resource to show up three times, for the three different
resources that use it. Alternatively, I would expect those three
resources to link to a single instance of the documentation for mytype.
Neither of these happen; instead the first resource shows up with the
mytype documentation, and the other two resources don't appear at all. I
suspect this has to do with either the id mangling that you do when you
expand the resources, or a failure to handle nodesets instead of a
single node at some point.

Perhaps, rather than expanding references to resource types and methods,
it would be better to show references as links, and document the
referenced elements separately. This would mirror the structure of the
wadl file a lot more closely, which might be a good thing since it would
ensure that the doc elements show up where the programmer put them, and
the same number of times the programmer wrote them.

It'd make the xslt simpler too, I think.

Doug.



-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Tuesday, January 27, 2009 8:46 AM
To: Webb, Douglas
Cc: [hidden email]
Subject: Re: Issues in WADL stylesheet when referencing faults or
methods

The values of the type attributes are URIs, in the case below you need  
type="#mytype" instead of type="mytype" - i.e. a fragment identifier  
for a resource_type element in the same document.

Does that help ?

Marc.

On Jan 26, 2009, at 1:06 PM, Webb, Douglas wrote:

>
> I'm having the same problem, and if it helps I'll describe the use  
> case
> I'm working with. One of my resource types allows resources to be
> identified under three different URI templates. I don't want to have  
> to
> repeat the entire resource definition for each URI, so I'm using the
> same type attribute on three different resource elements, each of  
> which
> has a different path attribute and different param children.
>
> eg:
>
> <resource path="root">
>    <resource path="first/{firstcode}" type="mytype">
>        <param name="firstcode" style="template"/>
>    </resource>
>    <resource path="second/{secondcode}" type="mytype">
>        <param name="secondcode" style="template"/>
>    </resource>
>    <resource path="third/{thirdcode}" type="mytype">
>        <param name="thirdcode" style="template"/>
>    </resource>
> </resource>
>
> <resource_type id="mytype">
>    ...
> </resource_type>
>
>
> This should allow a particular resource, whose type is "mytype", to be
> available under /root/first/abc, /root/second/123, and /root/third/
> xyz,
> assuming that the service understands that all three refer to the same
> resource. Other resources in my system will link to "mytype" resources
> using whichever URI is most convienient/available.
>
> Thanks for your help!
>
> Douglas Webb
>
>
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.