History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-696
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mathias Bogaert
Reporter: Eric Hauser
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

StreamResult should accept file option

Created: 10/Dec/04 06:04 PM   Updated: 14/Dec/04 01:30 AM
Component/s: Misc
Affects Version/s: 2.2
Fix Version/s: 2.1.7


 Description  « Hide
Sometimes what you want to stream to the response is a file with a given name, a PDF for instance. In that case, you need to set the header:

"Content-disposition", "attachment; filename.pdf"

The StreamResult class should be enhanced so that it has the ability to take a filename and set the header.

 All   Comments   Change History      Sort Order:
Mathias Bogaert - [12/Dec/04 06:09 AM ]
I've added support for the Content-disposition header, but you will need to put the file inputstream on the stack yourself, this is outside the scope for StreamResult IMO.

Eric Hauser - [13/Dec/04 08:01 AM ]
I'm not sure what you mean about adding the file to the stack. The class already takes an InputStream as a parameter, so using the StreamResult to output a file is as simple as adding the option you added.

Mathias Bogaert - [14/Dec/04 01:30 AM ]
Erik, what I meant was adding a 'file' property (setFile(java.io.File file) - and thus getting the inputstream from the file in the StreamResult).