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] [Comment Edited] (CXF-6793) InvocationCallback doesn't try to get response class type
Date Mon, 22 Feb 2016 15:53:18 GMT

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

Sergey Beryozkin edited comment on CXF-6793 at 2/22/16 3:52 PM:
----------------------------------------------------------------

Right, adding few Ts helped to reproduce it, and I've fixed it:

https://github.com/apache/cxf/commit/7a2d475073ad1671d729f2d4f8031df74fec1b1a

Note it is actually Response that will be injected into InvocationCallback. 
If you do '.get().get()' in your code instead of '.get(createCallback()).get()' then Response
will be returned, so if you have
a callback with the unbounded T then for the consistency it has to be Response too. In such
cases, in your callback, cast the provided value to Response and then do response.readEntity(myType.class)
or response.readEntity(Object.class).
 
Or simply return InvocationCallback<Response> 


was (Author: sergey_beryozkin):
Right, adding few Ts helped to reproduce it, and I've fixed it:

https://github.com/apache/cxf/commit/7a2d475073ad1671d729f2d4f8031df74fec1b1a

Note it is actually Response that will be injected into InvocationCallback. 
If you do '.get().get()' in your code instead of '.get(createCallback()).get()' then Response
will be returned, so if you have
a callback with the unbounded T then for the consistency it has to be Response too. In such
cases, in your callback, cast the provided value to Response and then do response.readEntity(myType.class)
or response.readEntity(Object.class).
  

> InvocationCallback doesn't try to get response class type
> ---------------------------------------------------------
>
>                 Key: CXF-6793
>                 URL: https://issues.apache.org/jira/browse/CXF-6793
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.1.5
>            Reporter: Romain Manni-Bucau
>
> in org.apache.cxf.jaxrs.client.WebClient#doInvokeAsyncCallback the webclient could try
to find the response class if not there.
> would avoid to give a null type the providers can't use to do what they need to
> Code can be if respClass is null and callback is not null something like:
> {code}
> // in real code filter interfaces and dont access them directly by index
> ParameterizedType.class.cast(callback.getClass().getGenericInterfaces()[0]).getActualTypeArguments()[0]
> {code}
> edit: digging a bit seems org.apache.cxf.jaxrs.utils.InjectionUtils#getSuperType just
doesn't default to anything and in case of TypeVariable unbounded is not able to default to
Object so if bound is really Object it fails
> if it helps here is the code I use: https://gist.github.com/rmannibucau/09a084c28d8b61c232cf
- of course would like to make the class geenric (<T>) and remove this String typing
;)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message