Hi,
We have a webapplication and we are using JRC from CR4E to serve Report in PDF format in the response. I am using ReportControl.processHttpRequest() API to serve the response.
The question is:
In ReportExportControl.processhttpRequest(HttpServletRequest request, HttpServletResponse response, ServletContext context, java.io.Writer out), what should be passed as "out"?
If I pass null, and if multiple users try to access the report, i.e. multiple threads call this API, I get java.lang.IllegalThreadStateException intermittently.
On the other hand, if I pass response.getWriter() and also set the contentType and character encoding of the response, I do not get this exception when multiple users are accessing the report. Following is the code snippet for this.
response.setContentType("application/pdf");
response.setCharacterEncoding("UTF-8");
IReportSource reportSource = reportClientDocument.getReportSource();
ReportExportControl exportControl = new ReportExportControl();
ExportOptions exportOptions = new ExportOptions();
PDFExportFormatOptions pdfexpopts = new PDFExportFormatOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF);
exportOptions.setFormatOptions(pdfexpopts);
exportControl.setReportSource(reportSource);
exportControl.setExportOptions(exportOptions);
exportControl.processHttpRequest(request, response, getServletContext(), response.getWriter());
exportControl.dispose();
Can any body please explain the purpose of the (java.io.Writer out) parameter in the processHttpRequest API, and what happens internally in the API when null is passed.
Thank you,
Deepak