You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2010/07/09 22:52:50 UTC

[jira] Resolved: (CXF-2862) Provide an annotation to allow customisation of the elements declared in the request & response representation in the auto-generated wadl

     [ https://issues.apache.org/jira/browse/CXF-2862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2862.
-----------------------------------

    Fix Version/s: 2.3
                   2.2.10
       Resolution: Fixed

slightly modified patch has been applied, thanks

> Provide an annotation to allow customisation of the elements declared in the request & response representation in the auto-generated wadl
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2862
>                 URL: https://issues.apache.org/jira/browse/CXF-2862
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.2.9
>            Reporter: Matthew Smith
>            Priority: Minor
>             Fix For: 2.3, 2.2.10
>
>         Attachments: WadlElement.patch
>
>
> In using the auto-generated wadl for jax-rs rest services in cxf (2.2.9) I have found that all my jaxb annotated xml beans are defined in the grammars section of the wadl, but they are not referenced as elements in the representation element of methods in the resources section. Indeed it would be difficult to automatically determine the correct element for methods that return a Response object containing a jaxb annotated object instead of  returning the object itself.
> To overcome this I suggest creating a WadlElement annotation that allows the method to be annotated with the class accepted in the request and returned by the response even where it is not the declared return type of the method.
> For example, the following method declaration in a Rest service currently produces an auto-generated wadl as shown below:
> // method from jax-rs service:
> 	@POST
>  	@Path("/")
>  	@Produces("application/xml")
>  	@Consumes("application/xml")
> 	public Response doStuff(@Context MessageContext context, MyXmlBean bean) {
>  	 	return Response.ok(bean, MediaType.APPLICATION_XML_TYPE).build();
>  	 }
> <!-- snippet of auto-generated wadl: -->
>     <resource path="/">
>       <method name="POST">
>         <request>
>           <representation mediaType="application/xml" />
>         </request>
>         <response>
>           <representation mediaType="application/xml" />
>         </response>
>       </method>
> Using the annotation, this would become:
> // method from jax-rs service using annotation:
> 	@POST
>  	@Path("/")
>  	@Produces("application/xml")
>  	@Consumes("application/xml")
> 	@WadlElement(request = MyXmlBean.class, response = MyXmlBean.class)
> 	public Response doStuff(@Context MessageContext context, MyXmlBean bean) {
>  	 	return Response.ok(bean, MediaType.APPLICATION_XML_TYPE).build();
>  	 }
> <!-- snippet of auto-generated wadl usign annotation. Note that the element "myXmlBean" is defined in the grammars section of the wadl: -->
>     <resource path="/">
>       <method name="POST">
>         <request>
>           <representation mediaType="application/xml" element="myXmlBean" />
>         </request>
>         <response>
>           <representation mediaType="application/xml" element="myXmlBean" />
>         </response>
>       </method>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.