×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
This is more generic to web programming so I hope you folks have an idea.
I have a servlet application that has, as one small part, a routine that
builds and then downloads an excel spreadsheet. It first calls a
routine that builds the sheet using poi to a temporary folder and then
calls a second routine that streams that data to the browser, prompting
the user for a download or open. This routine *was* working perfectly.
However, I was working on another part of the application and doing some
testing and discovered that the download routine is no longer working.
Well, it works, but the resulting file isn't recognized as an excel
spreadsheet. I looked at the old source and there are no differences is
this particular method. So it must be an "environment" issue (I think).
The relevant part of the java code is (I think):
if(finishedOK){ // Did the build of the spreadsheet complete OK?
// *output the spreadsheet
outFile = getSpreadSheet(ssd.getSheetFileName(),userContainer);
// returns a byte array of the file
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition"," inline;
filename=mismatched.xls");
try {
output = new BufferedOutputStream(response.getOutputStream());
output.write(outFile);
output.flush();
output.close();
} catch(IOException ioe){
System.err.println("IOException(102) doing fileload:
"+ioe.getMessage());
}
}
I can open the spreadsheet that is created by poi in the temporary
folder just fine. It is just when it is retrieved from the folder and
streamed to the browser, I get an error.
I get the same error whether I deploy to the System i and run it, or run
it in debug locally in windows from within Eclipse. For the life of me I
can't figure it out. I thought it might have been something locally on
my notebook, given the multiple JVM's and environmental stuff I mess
with, but even the deployment to the System i is broken.
The files (original and downloaded) look identical. Same size when the
properties are viewed, etc.
Ideas? I am stumped.
Pete Helgren
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.