cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5475) wadl2java fails when using representation reference
Date Mon, 23 Dec 2013 16:03:51 GMT

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

Sergey Beryozkin commented on CXF-5475:
---------------------------------------

Thanks for all the analysis :-)

> wadl2java fails when using representation reference
> ---------------------------------------------------
>
>                 Key: CXF-5475
>                 URL: https://issues.apache.org/jira/browse/CXF-5475
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.0-milestone1
>            Reporter: Guus der Kinderen
>            Priority: Minor
>              Labels: wadl2java
>         Attachments: cxf-5475.tar.gz
>
>
> It appears that wadl2java fails to produce some code when a response representation is
defined as a reference (as opposed to an inline definition).
> To illustrate the issue, snippets of a WADL are provided below. Each snippet is followed
by a snippet of code as generated by wadl2java.
>  
> The first WADL snippet defines a response representation inline:
> {code:xml}<resource path="inline">
>     <method name="GET">
>         <response status="200">
>             <representation element="SkuType" mediaType="application/xml"/>
>         </response>
>     </method>
> </resource>
> {code}
> This Java code is generated:
> {code:java}
> @Path("inline")
> public interface InlineResource {
>     @GET
>     @Produces("application/xml")
>     Response get();
> }
> {code}
> When the response representation is using a representation reference[^(1)^|http://www.w3.org/Submission/wadl/#x3-220002.11.1],
then the generated code appears to be missing details. This modified WADL snippet illustrates
the issue:
> {code:xml}
> <resource path="reference">
>     <method name="GET">
>         <response status="200">
>             <representation href="SkuRep"/>
>         </response>
>     </method>
> </resource>
> <representation id="SkuRep" element="SkuType" mediaType="application/xml"/>{code}
> Based on the last WADL snippet, this Java code is generated:
> {code:java}@Path("reference")
> public interface ReferenceResource {
>     @GET
>     @Produces()
>     Response get();
> }{code}
> *Observed behavior* 
> Code details are missing (note that the media type is missing from the last snippet of
Java code), when a representation reference is used.
> *Expected behavior*
> wadl2java should generate similar Java code for both WADL snippets that are provided
above.
> Side-note: when the mediaType attribute is added to the representation reference the
generated code looks ok. However, this appears to be prohibited by the WADL specification:
??"A representation reference element MUST NOT have any other WADL-defined attributes or contain
any WADL-defined child elements.??"
> {code:xml}
> <resource path="illegal">
>     <method name="GET">
>         <response status="200">
>             <representation href="SkuRep" mediaType="application/xml"/>
>         </response>
>     </method>
> </resource>{code}
> {code:java}@Path("illegal")
> public interface IllegalResource {
>     @GET
>     @Produces("application/xml")
>     Response get();
> }{code}
> Note that for the purpose of illustrating the problem, the mediaType attribute was used.
The issue might or might not affect other attributes or aspects of code generation (this remains
untested).
> The behavior described in this issue was reproduced using the wadl2java Maven plugin,
version 3.0.0-milestone1.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message