Jasper 异步报告 - 空,为什么?
Jasper Async Report - Empty, why?
让我们开始吧,首先我为示例获取特定报告的参数
var config = {
url : "http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport/inputControls",
method: "GET",
headers: {
Accept: "application/json;"
},
}
一切正常,我收到了一个输入数组的响应,
数组包含 2 个对象:
第一个:
{
description: "Date_from",
id: "Date_from",
label: "Date from",
type: "singleValueDate"
}
第二个:
{
description: "Date_to",
id: "Date_to",
label: "Date_to",
type: "singleValueDate"
}
两个输入都有 属性:
validationRules[0].dateTimeFormatValidationRule.format = "yyyy-MM-dd"
所以现在我想 运行 一个异步报告(我现在将传递异步参数 false,因为这里的代码较少)
var params ={
reportUnitUri: "/reportFolder/exampleReport",
outputFormat: "html",
freshData : true,
saveDataSnapshot : false,
ignorePagination: true,
async : false,
interactive: false,
allowInlineScripts: true,
parameters: {
"Date_from":["2014-08-01"],
"Date_to":["2015-10-08"]
}
}
所以现在我尝试生成异步报告:
var config = {
url : "http://exmaple.com/jasperserver/rest_v2/reportExecutions",
headers: {
Accept: "application/json"
},
data: params,
method: "POST"
}
我得到了成功响应,但是
totalPages: 0,
requestId: "0200cf28-300f-4e76-b99e-e479be4980ba",
reportURI: "/reportFolder/exampleReport/",
status: "ready",
exports[0].id: "c9a5578a-6bc8-4c3e-8a78-9056ef19f456",
exports[0].status: "ready",
exports[0].outputResource :{
contentType: "text/html",
outputFinal: true
}
当我尝试通过调用 :
获取报告的输出时
http://exmaple.com/jasperserver/rest_v2/reportExecutions/0200cf28-300f-4e76-b99e-e479be4980ba/exports/c9a5578a-6bc8-4c3e-8a78-9056ef19f456/outputResource
报告为空。
同样通过 :
http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport.html?Date_from=2014-08-01&Date_to=2015-09-08
给我一份完整的报告,
谁能指出我做错了什么? :/
我很确定参数可能有问题,但我尝试了各种方法,但我自己找不到解决方案:/
问题是传递给异步报告的参数格式不正确,应该是这样的:
parameters: {
reportParameter: [
{name : "Date_from",value : ["2014-08-01"]},
{name : "Date_to",value : ["2015-10-08"]}
]
}
让我们开始吧,首先我为示例获取特定报告的参数
var config = {
url : "http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport/inputControls",
method: "GET",
headers: {
Accept: "application/json;"
},
}
一切正常,我收到了一个输入数组的响应,
数组包含 2 个对象:
第一个:
{
description: "Date_from",
id: "Date_from",
label: "Date from",
type: "singleValueDate"
}
第二个:
{
description: "Date_to",
id: "Date_to",
label: "Date_to",
type: "singleValueDate"
}
两个输入都有 属性:
validationRules[0].dateTimeFormatValidationRule.format = "yyyy-MM-dd"
所以现在我想 运行 一个异步报告(我现在将传递异步参数 false,因为这里的代码较少)
var params ={
reportUnitUri: "/reportFolder/exampleReport",
outputFormat: "html",
freshData : true,
saveDataSnapshot : false,
ignorePagination: true,
async : false,
interactive: false,
allowInlineScripts: true,
parameters: {
"Date_from":["2014-08-01"],
"Date_to":["2015-10-08"]
}
}
所以现在我尝试生成异步报告:
var config = {
url : "http://exmaple.com/jasperserver/rest_v2/reportExecutions",
headers: {
Accept: "application/json"
},
data: params,
method: "POST"
}
我得到了成功响应,但是
totalPages: 0,
requestId: "0200cf28-300f-4e76-b99e-e479be4980ba",
reportURI: "/reportFolder/exampleReport/",
status: "ready",
exports[0].id: "c9a5578a-6bc8-4c3e-8a78-9056ef19f456",
exports[0].status: "ready",
exports[0].outputResource :{
contentType: "text/html",
outputFinal: true
}
当我尝试通过调用 :
获取报告的输出时 http://exmaple.com/jasperserver/rest_v2/reportExecutions/0200cf28-300f-4e76-b99e-e479be4980ba/exports/c9a5578a-6bc8-4c3e-8a78-9056ef19f456/outputResource
报告为空。
同样通过 :
http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport.html?Date_from=2014-08-01&Date_to=2015-09-08
给我一份完整的报告,
谁能指出我做错了什么? :/ 我很确定参数可能有问题,但我尝试了各种方法,但我自己找不到解决方案:/
问题是传递给异步报告的参数格式不正确,应该是这样的:
parameters: {
reportParameter: [
{name : "Date_from",value : ["2014-08-01"]},
{name : "Date_to",value : ["2015-10-08"]}
]
}