Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0F84F200BC5 for ; Tue, 22 Nov 2016 15:09:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0E1E0160B0C; Tue, 22 Nov 2016 14:09:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 56CCE160B0A for ; Tue, 22 Nov 2016 15:08:59 +0100 (CET) Received: (qmail 96167 invoked by uid 500); 22 Nov 2016 14:08:58 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 96154 invoked by uid 99); 22 Nov 2016 14:08:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Nov 2016 14:08:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 564E42C4C70 for ; Tue, 22 Nov 2016 14:08:58 +0000 (UTC) Date: Tue, 22 Nov 2016 14:08:58 +0000 (UTC) From: "John Poth (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-7147) Unable to register a generic _InvocationCallback_ when using the async proxy client API in JAX-RS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 22 Nov 2016 14:09:00 -0000 [ https://issues.apache.org/jira/browse/CXF-7147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15686843#comment-15686843 ] John Poth commented on CXF-7147: -------------------------------- Hi [~sergey_beryozkin], Thanks for looking into this. 1- Registering InvocationCallback will not pass the check (I just re-verified). This is because at runtime, _callbackRespClass_ will be set to _java.lang.Void.class_ whereas _methodReturnType_will be set to _java.lang.Void#TYPE_ and therefore {code} callbackRespClass.isAssignableFrom(methodReturnType) {code} will return false. Some people treat void as a primitive (after all Void.TYPE.isPrimitive() does return true) which will solve this. This can be changed and added to PrimitiveUtils, I can update the PR if you think this makes sense. This will remove the Response and Object corner cases. 2- Adding the check for InvocationCallback will fail later on in the code when you receive the response. You will get a casting exception [here|https://github.com/apache/cxf/blob/master/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JaxrsClientCallback.java#L76] for methods that return instances that cannot be casted to Response. Hope this clears things up, John. > Unable to register a generic _InvocationCallback_ when using the async proxy client API in JAX-RS > --------------------------------------------------------------------------------------------------------- > > Key: CXF-7147 > URL: https://issues.apache.org/jira/browse/CXF-7147 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Reporter: John Poth > > It is currently impossible to register a generic _InvocationCallback_ when invoking a method that returns void. This is due to a [check|https://github.com/apache/cxf/blob/master/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java#L797] that isn't satisfied when the _methodReturnType_ is void. I propose to add the following case > {code} > Object.class == callbackRespClass > {code} > And let the user handle the logic. > I also propose to remove the condition > {code} > Response.class == callbackRespClass > {code} > Which will lead to failure when [casting|https://github.com/apache/cxf/blob/master/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/JaxrsClientCallback.java#L76] to a return type upon completion. I will provide a PR. > [~sergey_beryozkin] sorry for the confusion. -- This message was sent by Atlassian JIRA (v6.3.4#6332)