You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does it work on the newest released PrimeFaces version? Version?
Does it work on the newest sources in GitHub? no
Application server + version: Open Liberty 18.0.0.2 with jsf-2.2 (MyFaces 2.2)
Affected browsers: all
2) Expected behavior
No warning messages are printed when using p:fileDownload to download a file.
3) Actual behavior
Downloading files that are larger than the servlet response buffer size results in a WebSphere warning message: [WARNING ] WARNING: Cannot set status. Response already committed.
4) Steps to reproduce
Use a p:fileDownload button to attempt to download a large file; a warning message will be printed to the output log for every (download) request.
public class UploadController implements java.io.Serializable {
public UploadController() {
}
public StreamedContent getXLSExport() {
byte[] bytes = new byte[33000]; // larger than 32K
for (int i = 0; i < 33000; i++) {
bytes[i] = 'f';
}
byte[] content = bytes;
return new DefaultStreamedContent(new ByteArrayInputStream(content), "application/csv", "something.xlsx", "UTF-8");
}
}
The problem here looks to be that FileDownloadActionListener.processAction() makes a call to update the response status code after writing the entire contents of the downloaded file to the response output stream. If the downloaded file length is larger than the response output stream buffer size, then on WebSphere the response will be committed - and then the status code cannot be updated.
A fix for this would be to check externalContext.isResponseCommitted() before trying to call externalContext.setResponseStatus(200)
The text was updated successfully, but these errors were encountered:
1) Environment
jsf-2.2
(MyFaces 2.2)2) Expected behavior
No warning messages are printed when using
p:fileDownload
to download a file.3) Actual behavior
Downloading files that are larger than the servlet response buffer size results in a WebSphere warning message:
[WARNING ] WARNING: Cannot set status. Response already committed.
4) Steps to reproduce
Use a
p:fileDownload
button to attempt to download a large file; a warning message will be printed to the output log for every (download) request.5) Sample XHTML
6) Sample bean
The problem here looks to be that
FileDownloadActionListener.processAction()
makes a call to update the response status code after writing the entire contents of the downloaded file to the response output stream. If the downloaded file length is larger than the response output stream buffer size, then on WebSphere the response will be committed - and then the status code cannot be updated.A fix for this would be to check
externalContext.isResponseCommitted()
before trying to callexternalContext.setResponseStatus(200)
The text was updated successfully, but these errors were encountered: