java rest集合参数,Jasper REST传递集合作为参数

I have a report which receives a List parameter to use it in a IN clause:

$X{IN, personID, _personID}

The report works when running it through the web application or remote repository view in iReport.

Now I need to call it using the REST api. I have tried several different ways of passing the list value in my resource descriptor but none of them worked.

The above example returns the following error:

Invalid type java.lang.String for parameter _personId used in an IN clause; the value must be an array or a collection.

I have also try the following:

_personId

3

But this returns a report with all the records, not only the person with Id=3.

解决方案

My workaround for this problem was to use the REST V2 services of JasperServer.

Added to this the V2 has two advantages over the first version of the service:

it doesn't require a resource descriptor

it runs and exports the report in a single GET request

All the information required to run and export the report is passed through the request URL, for example:

/rest_v2/reports/Test/TestReport.html?_personId=3&_personId=4&_personId=5&_personId=6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值