关于节俭函数返回列表 [英] regarding thrift function return list

查看:23
本文介绍了关于节俭函数返回列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有返回对象 ABC 列表的函数的节俭服务:

i have thrift service with a function returning list of Object ABC:

struct ABC
{

     1: string user_id;

     2: string foo;

     3: optional list<string> data;
}


list<ABC> getABCByUser(1:required string user_id, 2:i32 limit,3:i32 pageId, 4:string lastDocID)
throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException    te)

服务器端由c++编写我打印出服务器端返回的结果,在getABCByUser的响应中ABC实例中的数据不为空.

server side written by c++ I print out result returned by server side, data in ABC instance is NOT null in the response of getABCByUser.

在java编写的客户端上如何:我在java端thrift生成的代码中设置了断点,ABC实例中的数据为空,其他字段不为空.它看起来像是客户端的问题.知道如何解决这个问题吗?

How ever on client side which is written by java: I set break point in the code generated by thrift on java side, data in ABC instance is null, other fields are not null. it looks like a issue on the client side. Any idea how to fix this issue?

提前致谢!

推荐答案

我和你遇到了同样的问题.我发现如果删除列表之前的可选"修饰符,返回值将是正确的.但我不知道为什么我们不能在列表前使用可选".

I encounter the same problem with you. I found that if delete the "optional" modifier before list, the return value will be right. But I don't know why we can't use "optional" before list.

这篇关于关于节俭函数返回列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆