Donwloading file
gred Feb 16, 2010 11:48 AMHi all.
I'm facing the following problem.
I'm using seam 2.2 with richfaces 3.3.1. I'm using the following lines of code to download a file through seam:
ttpServletResponse response = (HttpServletResponse)extCtx.getResponse();
response.setContentType("images/jpeg");
response.addHeader("Content-disposition", "attachment; filename=\"" + newCustomer.getFile().getFileName() +"\"");
FileInputStream fis = null;
try {
byte[] fData = new byte[4096];
fis = new FileInputStream(new File(newCustomer.getFile().getFilePath() + newCustomer.getFile().getFileName()));
ServletOutputStream os = response.getOutputStream();
while(fis.read(fData, 0, 4096) != -1) {
os.write(fData, 0, 4096);
}
//os.write(fData);
os.flush();
os.close();
FacesContext.getCurrentInstance().responseComplete();
//facesContext.responseComplete();
} catch(Exception e) {
log.error("\nFailure : " + e.toString() + "\n");
}
When I deploy my application to an enterprise application platform (v 5.0) everything works fine. When I deploy the EXACT same ear to a jboss application server 5.0.0 I get the following error:
Failure : java.util.MissingResourceException: Can't find resource for bundle org.ajax4jsf.Messages$EmptyResourceBundle, key CREATE_STREAM_INFO
in line:
ServletOutputStream os = response.getOutputStream();
I can't find anything in the web for this issue.
I though that the problem is that the richfaces resource bundle lies in a lib inside the war of the application where the resource CREATE_STREAM_INFO can see it.
So I thought of moving all the richfaces lib to the ear but I don't know if I'm on the right track for this issue!!
Thank you!
I'm facing the following problem.
I'm using seam 2.2 with richfaces 3.3.1. I'm using the following lines of code to download a file through seam:
ttpServletResponse response = (HttpServletResponse)extCtx.getResponse();
response.setContentType("images/jpeg");
response.addHeader("Content-disposition", "attachment; filename=\"" + newCustomer.getFile().getFileName() +"\"");
FileInputStream fis = null;
try {
byte[] fData = new byte[4096];
fis = new FileInputStream(new File(newCustomer.getFile().getFilePath() + newCustomer.getFile().getFileName()));
ServletOutputStream os = response.getOutputStream();
while(fis.read(fData, 0, 4096) != -1) {
os.write(fData, 0, 4096);
}
//os.write(fData);
os.flush();
os.close();
FacesContext.getCurrentInstance().responseComplete();
//facesContext.responseComplete();
} catch(Exception e) {
log.error("\nFailure : " + e.toString() + "\n");
}
When I deploy my application to an enterprise application platform (v 5.0) everything works fine. When I deploy the EXACT same ear to a jboss application server 5.0.0 I get the following error:
Failure : java.util.MissingResourceException: Can't find resource for bundle org.ajax4jsf.Messages$EmptyResourceBundle, key CREATE_STREAM_INFO
in line:
ServletOutputStream os = response.getOutputStream();
I can't find anything in the web for this issue.
I though that the problem is that the richfaces resource bundle lies in a lib inside the war of the application where the resource CREATE_STREAM_INFO can see it.
So I thought of moving all the richfaces lib to the ear but I don't know if I'm on the right track for this issue!!
Thank you!