[
https://issues.apache.org/jira/browse/CXF-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239635#comment-13239635
]
Marko Voss commented on CXF-4205:
---------------------------------
Hi Sergey,
I am not trying to convince you here, I just like to reply. :-)
> Now, given that GenericResponse will be CXF specific, why would not we simply
> return [...]?
The GenericResponse would be a general class handling this issue and the
GenericResponseReader could become a default provider, which is always
registered. So all CXF users do not need to care about it. If the user defines
an own class like MetaObject<JaxbObj>, he has to implement the Filter and/or
MessageBodyReader/-Writer for it.
> Having something like GenericResponse would also require us handling
> GenericResponse<List<JaxbObj>>
Well, there are limits and I think GenericResponse<JaxbObj> should cover 99% of
all use cases. Is List<JaxbObj> even a valid return type, the user does not
need to implement a MessageBodyReader/-Writer for? How is the List supposed to
be marshalled? Never tried that.
It is understandable, that you like to wait for JAX-RS 2.0. We - however -
cannot wait for it and I had to solve this issue better yesterday than
tomorrow. I just liked to share the outcome. :-)
> Please add generic type to javax.ws.rs.core.Response implementation
> -------------------------------------------------------------------
>
> Key: CXF-4205
> URL: https://issues.apache.org/jira/browse/CXF-4205
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 2.5.2
> Reporter: Marko Voss
> Assignee: Sergey Beryozkin
> Attachments: GenericResponse.java, GenericResponseReader.java
>
>
> Let's assume, we have the following JAX-RS interface:
> @Path("/foo")
> public interface Foo {
> @Path("{id})
> JaxbObj retrieve(@PathParam("id");
> }
> Now, we want to change some headers for the response, so we have to change
> the interface to this:
> @Path("/foo")
> public interface Foo {
> @Path("{id})
> Response retrieve(@PathParam("id");
> }
> In our scenario, we want to offer the customers a basic client library, so
> that they do not need to implement mapping and everything again. Therefore we
> are reusing the JAX-RS interfaces on the client-side. Thanks to the maven
> dependency techniques the client library will also inherit the generated JAXB
> classes, CXF setup and everything else, the client requires to communicate
> with the server.
> So the client will now have to deal with the Object supplied by the
> Response.getEntity() method and kinda have to guess the type. If the Response
> type would be generic, there would not be such an issue. (example:
> Response<JaxbObj>)
> Since you may not be responsible for the Response interface, maybe you could
> add an extended interface or implementation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira