You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2011/04/20 23:59:02 UTC

How to properly set "title" in generated WADL

My controller class has a @Description annotation with both "title" and "value" properties.

Here is an abbreviated excerpt from the generated WADL:
------------------
  <resources base="http://myuri">
    <resource path="mypath">
      <doc title="mytitle">mydescription</doc>
------------------

This all seems reasonable.  I'm trying to use a spreadsheet that generates docs from a WADL, from < https://github.com/mnot/wadl_stylesheets>.  It mostly works, but it's not getting my title value.  This is possibly just a XSLT bug in the spreadsheet, or perhaps there are different interpretations of where the title should go.

Here's an excerpt from the spreadsheet:
----------------------
    <xsl:template match="/wadl:application">   
        <html>
            <head>
                <title>
                    <xsl:choose>
                        <xsl:when test="wadl:doc[@title]">
                            <xsl:value-of select="wadl:doc[@title][1]/@title"/>
                        </xsl:when>
                        <xsl:otherwise>My Web Application</xsl:otherwise>
                    </xsl:choose>                 
                </title>
------------------------

I believe this test is looking for a "wadl:doc" element that has a "@title" attribute, within the "wadl:application" element.  In my WADL, the above "doc" element should match that. However, it generates "My Web Application" in the HTML, so it somehow didn't match.

I haven't gotten into actually debugging the stylesheet, to see if something else is going on, but I wanted to ask first if everything looks normal in my WADL, and what the stylesheet should expect.

Re: How to properly set "title" in generated WADL

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi David

Please see [1]. I've added 3 extra properties:
- applicationTitle (String, can be used to set a
wadl/application/wadl:doc/@title)
- namespacePrefix (String, can be used to override the default prefix if needed)
- ignoreForwardSlash (boolean) - if the stylesheet adds '/' itself
when concatenating path values then setting this value to false will
help.

You can just link to a customized WADLGenerator bean from
jaxrs:providers section

Thanks, Sergey

[1] https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Services+Description#JAXRSServicesDescription-CustomWADLproviders

On Wed, Apr 20, 2011 at 11:17 PM, KARR, DAVID (ATTSI) <dk...@att.com> wrote:
>> -----Original Message-----
>> From: KARR, DAVID (ATTSI)
>> Sent: Wednesday, April 20, 2011 2:59 PM
>> To: users@cxf.apache.org
>> Subject: How to properly set "title" in generated WADL
>>
>> My controller class has a @Description annotation with both "title" and
>> "value" properties.
>>
>> Here is an abbreviated excerpt from the generated WADL:
>> ------------------
>>   <resources base="http://myuri">
>>     <resource path="mypath">
>>       <doc title="mytitle">mydescription</doc>
>> ------------------
>>
>> This all seems reasonable.  I'm trying to use a spreadsheet that
>> generates docs from a WADL, from <
>> https://github.com/mnot/wadl_stylesheets>.  It mostly works, but it's
>> not getting my title value.  This is possibly just a XSLT bug in the
>> spreadsheet, or perhaps there are different interpretations of where
>> the title should go.
>
> Ok, I think I see one issue.  This stylesheet is checking for the "doc" element in the "application" element, but CXF's @Description annotation on the controller results in putting the title and description in the "resource" element.
>
> It sounds like any documentation at the "application" level wouldn't be in the Controller, it would have to be in the "jaxrs:server" element, at least.
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

RE: How to properly set "title" in generated WADL

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Wednesday, April 20, 2011 2:59 PM
> To: users@cxf.apache.org
> Subject: How to properly set "title" in generated WADL
> 
> My controller class has a @Description annotation with both "title" and
> "value" properties.
> 
> Here is an abbreviated excerpt from the generated WADL:
> ------------------
>   <resources base="http://myuri">
>     <resource path="mypath">
>       <doc title="mytitle">mydescription</doc>
> ------------------
> 
> This all seems reasonable.  I'm trying to use a spreadsheet that
> generates docs from a WADL, from <
> https://github.com/mnot/wadl_stylesheets>.  It mostly works, but it's
> not getting my title value.  This is possibly just a XSLT bug in the
> spreadsheet, or perhaps there are different interpretations of where
> the title should go.

Ok, I think I see one issue.  This stylesheet is checking for the "doc" element in the "application" element, but CXF's @Description annotation on the controller results in putting the title and description in the "resource" element.

It sounds like any documentation at the "application" level wouldn't be in the Controller, it would have to be in the "jaxrs:server" element, at least.