We have a JasperReports Server (5.5.0 community edition) running our reports and consuming them through REST services API from our web application.
When we ask a report output through reports execution API we get the proper output and we are able to download it correctly, BUT, the problem is that the downloaded file is downloaded without an extension and therefore the final user can't open it propperly (it has to rename it or choose the proper program to open it). This is caused for several reasons according to what we were able to figure out:
First, the generated output on Jasper server has no name set up, here is an example:
{
"status": "ready",
"totalPages": 1,
"currentPage": null,
"errorDescriptor": null,
"requestId": "338384569_1404312281871_3",
"reportURI": "/uri_to_report",
"exports": [
{
"status": "ready",
"errorDescriptor": null,
"outputResource": {
"contentType": "application/xls",
"fileName": null
},
"id": "xls"
}
]
}
As we can see, the "fileName" property is null, and hence when we ask the output with
<JASPER_SERVER_URL/jasperserver/rest_v2/reportExecutions/338384569_1404312281871_3/exports/xls/outputResource>
we get a file called "outputResource" with no extension. This causes that download attribute on links element useless, we have tried this option. And we weren't able to figure out a way to set up this file name in Jasper server internally.
The other reason is that the MIME type of the response is not set properly for some output formats (we tried with XLS, XLSX and DOCX formats). As we can see, is set to "application/xls" for XLS output when should be "application/vnd.ms-excel" according to IANA or even MICROSOFT and the browser is not able to set up a default file name with the proper extension. For this, we have implemented a Servlet Filter in embedded Tomcat, but it seems that the response is flushed before we can set up the proper Content-Type header to it.
We are going to report this possible bug to Jasper community but since we wait an answer we keep searching for workarounds to this problem, so, any suggestions?
Thanks in advance to all of you.