We are using Servoy Version: 2023.3.6.3848_LTS, developing on Windows and deploying to Linux.
All of our reports are returned to the user as PDFs. Sometimes, although the plugin appears to be creating the required document it is not returned to the user. This problem happens if the user has left the Servoy solution running without interaction for two hours or more and then clicks a Print button.
We are using this method of the plugin:
@param {Object} reportDataSource the server name or foundset to run the report on
@param {String} report the report file (relative to the reports directory)
@param {Object} outputOptions the output file (must specify an absolute path) or null if not needed
@param {String} outputType the output format; use the constants node for available output formats
@param {Object} parameters a parameter map to be used when running the report
@return {byte[]} the generated reported as a byte array
byte[] runReport(reportDataSource:Object, report:String, outputOptions:Object, outputType:String, parameters:Object)
Our call from Servoy is:
plugins.jasperPluginRMI.runReport( goFieldsDS, sJasperTemplate, null, plugins.jasperPluginRMI.OUTPUT_FORMAT.PDF, oParams );
Note that we don’t send anything for the third argument: outputOptions.
Debugging has shown that the code spends the same amount of time in the Jasper plugin whether or not a PDF file is returned, which implies that the PDF is being created but we do not know where.
Looking through the source code for the JasperPluginRMI I see:
// in JasperReportsWebViewer.show 61
if(application instanceof IWebClientPluginAccess)
{
IWebClientPluginAccess wapp = (IWebClientPluginAccess) application;
IPageContributor pc = wapp.getPageContributor();
if (pc != null) {
String url = wapp.serveResource(getFixedFileName(file, ext), jsp, mimeType);
wapp.showURL(url, "_self", null, 0);
}
}
At this point the value of “file” is still null.
The getFixedFileName(file, ext) call looks like this:
if (file == null || file.length() == 0)
{
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
String DATE_FORMAT = "yyyyMMddHHmmss";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
sdf.setTimeZone(TimeZone.getDefault());
fixedFileName = "report_" + sdf.format(cal.getTime()) + "." + ext;
}
So that creates a file name with no path. For example: report_20240702083040.pdf
The key to understanding what happens in:
String url = wapp.serveResource(getFixedFileName(file, ext), jsp, mimeType);
wapp.showURL(url, "_self", null, 0);
depends on:
IWebClientPluginAccess wapp = (IWebClientPluginAccess) application;
The most recent Javadocs I can find are in https://developer.servoy.com/docs/publi … index.html
There it says:
Methods inherited from interface com.servoy.j2db.plugins.IAllWebClientPluginAccess
serveResource, serveResource, showURL, showURL, showURL
And those are precisely the methods whose details I need to see.
But unlike the other interfaces inherited by IWebClientPluginAccess there is no information given there on IAllWebClientPluginAccess!
So, I am unable to figure out just what this does:
String url = wapp.serveResource(getFixedFileName(file, ext), jsp, mimeType);
wapp.showURL(url, "_self", null, 0);
What actually happens when wapp.serveResource(getFixedFileName(file, ext), jsp, mimeType) is called?
Is the PDF file being created and written to a folder on the server?
If so, where?
If not, is it being created in-memory?
Any help would be greatly appreciated.