cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claude-Alain (JIRA)" <>
Subject [jira] [Commented] (CXF-5706) wadl2java: Return types aren't generated properly on server interfaces for methods with more than 1 response element.
Date Thu, 24 Apr 2014 16:00:20 GMT


Claude-Alain commented on CXF-5706:

Hello, Thanks for your quick reply.

Since I am using an exception mapper then I don't have any problem if I define multiple error
In the case I have multiple representations for normal statuses (for example: 200, 201) then
I won't be able to manage the code 201 if a return type is different that Response (except
if I use an exception mapper but it doesn't look like logical to do this).

You are saying that we can nominate methods that will return a Response object, how can we
do that?

The -tMap option won't work in my case, because some types that returned are also used in
the parameters passed in other methods.

An option that could be interesting would be a smilar one to -noVoidForEmptyResponses, but
instead of generating a Response type only the method that don't return a result (void) it
will generate a Resposne for all methods.


> wadl2java: Return types aren't generated properly on server interfaces for methods with
more than 1 response element.
> ---------------------------------------------------------------------------------------------------------------------
>                 Key: CXF-5706
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 3.0.0-milestone2
>         Environment: Java version "1.6.0_45"
> Windows 7 64 bit
>            Reporter: Claude-Alain
> Regarding this subject, a fix has been done (CXF-3662) but I have some reasons to think
that it has not been done in the right way.
> In the given example, there is one normal response (status code = 200) and one response
which is an error (status code = 400). In that case the fix is doing the right thing, the
first type is take into account and the error type can be managed by an exception mapper (from
what I see in the documentation of RESTEasy and Jersey).
> But in the case we introduce another response like shown in the example just below:
> {code:xml}
> <method name="GET" id="getUserDefaults">
> 	<doc>Gets default user configuration values.</doc>
> 	<response status="200">
> 		<representation mediaType="application/xml" element="fmc:userDefaults" />
> 	</response>
> 	<response status="204">
> 		<representation mediaType="application/xml" element="fmc:noContent" />
> 	</response>
> 	<response status="400">
> 		<representation mediaType="application/xml" element="fmc:errorList" />
> 	</response>
> </method>
> {code}
> then the return type for the corresponding method in the generated interface will be
"userDefaults". Since a Java method can only return an object of a given type then it will
never be possible to return an object of type "noContent".
> So I think the only way to solve this case is to return a type "".

> The only workaround I found is to remove the type type specified in the response to make
sure that we always have a return type "Response".

This message was sent by Atlassian JIRA

View raw message