How to stream a file out of portlet ActionResponse in JBoss Portal?
Issue
What is the correct/supported way to download a file, such as a spreadsheet, to the browser from a portlet? In a stand-alone application, I can do the following, but it doesn't work from the portlet:
// Set the content type for the response
response.setContentType("application/vnd.ms-excel");
// Open the output stream
outputStream = response.getOutputStream();
// Generate content and write it to the output stream
createRows(outputStream);
// clean resources
outputStream.flush();
outputStream.close();
Environment
- JBoss Enterprise Portal Platform (EPP)
- 4.3
- 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
