[ 
https://issues.apache.org/jira/browse/WINK-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507122#comment-13507122
 ] 

Etienne Canaud edited comment on WINK-372 at 11/30/12 6:03 AM:
---------------------------------------------------------------

I did implement the feature.

I attached modified files (WADLDoc.java, WADLGenerator.java, 
WADLGeneratorTest.java). 
Since my code style templates in Eclipse might not match the guidelines of this 
project, some reformatting on modified code could be needed.

Quick summary of changes:

WADLDoc.java: Added "content" element with default "" value as described above.

WADLGenerator.java: modified #getDocument(WADLDoc desc) to add content.

WADLGeneratorTest.java: Edited Resource1 class to add content to one of the 
WADLDoc annotation, and added test for annotation with content element and 
annotation without content element in #testWADLDocResource1().

Now, the annotation
@WADLDoc(value = "service title", content = "this is the service resource 
description")
will result in XML element
<doc title="service title">this is the service resource description</doc>

                
      was (Author: etiennec):
    I did implement the feature.

I attached modified files (WADLDoc.java, WADLGenerator.java, 
WADLGeneratorTest.java). 
Since my code style templates in Eclipse might not match the guidelines of this 
project, some reformatting on modified code could be needed.

Quick summary of changes:

WADLDoc.java: Added "content" element with default "" value as described above.

WADLGenerator.java: modified #getDocument(WADLDoc desc) to add content.

WADLGeneratorTest.java: Edited Resource1 class to add content to one of the 
WADLDoc annotation, and added test for annotation with content element and 
annotation without content element in #testWADLDocResource1().

Result is that the annotation
@WADLDoc(value = "service title", content = "this is the service resource 
description")
will result in XML element
<doc title="service title">this is the service resource description</doc>

                  
> Support for WADL Doc text content when using @WADLDoc annotation in Resource 
> class
> ----------------------------------------------------------------------------------
>
>                 Key: WINK-372
>                 URL: https://issues.apache.org/jira/browse/WINK-372
>             Project: Wink
>          Issue Type: Improvement
>          Components: Server
>    Affects Versions: 1.1.2, 1.1.3, 1.2
>            Reporter: Etienne Canaud
>            Priority: Trivial
>         Attachments: WADLDoc.java, WADLGenerator.java, 
> WADLGeneratorTest.java, Wink-WadlDocContent.patch
>
>
> Support for WADL was added in Wink 1.1.2 in Wink #313 
> (https://issues.apache.org/jira/browse/WINK-313).
> It is stated that "You can document your resources, params, and request 
> entities with @ WADLDoc to add some description."
> However, after some tests and a quick peek at the source code, it seems that 
> the @ WADLDoc annotation only takes one string parameter (value), and this 
> string will end up in the "title" of the WADL Doc element, while the content 
> of the Doc will remain empty and can't be assigned using annotations.
> You can refer to line 768 of WADLGenerator.java, where there is no sign of 
> the Doc content being set:
> {code:title= WADLGenerator.java|borderStyle=solid}
> Doc getDocument(WADLDoc desc) {
>         Doc d = new Doc();
>         d.setTitle(desc.value());
>         return d;
>     }
> {code}
> This improvement could be implemented in (at least) two different ways:
> 1) Add one element to WADLDoc annotation (i.e. instead of only value(), have 
> title() and content()).
> 2) Rename WADLDoc annotation to WADLDocTitle and create a new WADLDocContent 
> annotation, each having a single value() element. Both annotations would be 
> used to create the Doc object when generating WADL.
> Doc content is supposed to be mixed content (i.e. it can hold some 
> sub-elements) and my improvement request is only a half-baked implementation 
> where only text content would be supported. 
> I could eventually work on a patch once the implementation details are 
> specified if this improvement gets approved - still, changes should be pretty 
> straightforward.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to