Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 异步HandlerResponse为单个webmethod请求调用了两次_Java_Web Services_Rest_Asynchronous_Cxf Client - Fatal编程技术网

Java 异步HandlerResponse为单个webmethod请求调用了两次

Java 异步HandlerResponse为单个webmethod请求调用了两次,java,web-services,rest,asynchronous,cxf-client,Java,Web Services,Rest,Asynchronous,Cxf Client,我使用ApacheCXFAPI开发了一个异步JAX-RSWeb方法。webmethod采用自定义类型作为参数,如中所示 @POST @Path("/query") @Produces(MediaType.APPLICATION_JSON) @Consumes(value={MediaType.APPLICATION_JSON , "application/CustomType"}) public void getQueryResults(@Suspended final AsyncRe

我使用ApacheCXFAPI开发了一个异步JAX-RSWeb方法。webmethod采用自定义类型作为参数,如中所示

 @POST
 @Path("/query")
 @Produces(MediaType.APPLICATION_JSON)
 @Consumes(value={MediaType.APPLICATION_JSON , "application/CustomType"})
 public void getQueryResults(@Suspended final AsyncResponse asyncResponse,    CustomType conf)
我已经实现了(服务端和客户端)一个自定义MessageBodyReader和MessageBodyWriter来处理序列化我的“CustomType”。 在客户端,我将修改后的

Client client = ClientBuilder.newClient().register(CacheConfigReader.class).register(CacheConfigWriter.class); 
我向已创建的服务发出异步请求

asyncResponse.resume(result); // result is a string
论客户

Future<String> future = asyncInvoker.post(entity, String.class);
其中一个带有实际结果,另一个为空。根据首先执行的内容,结果是实际字符串或空字符串。调用的跟踪包含来自阶段拦截器链的调用。 只有在向自定义读写器注册客户端时,才会发生这种情况。当我使用json设置请求主体时,只有一个线程处理响应。 有人能解释为什么添加MessageBodyReaders/Writer会导致这个问题吗

 JaxrsClientCallback . handleResponse()