Re: download binary content

2004-08-25 Thread Erik Weber
25 August 2004 16:14 To: Struts Users Mailing List Subject: Re: download binary content The difference between your implementation and mine is that I am not setting the Cache-Control, Content-Disposition and Content-Length headers. My download action seems to work fine in IE and Mozilla, but, could

RE: download binary content

2004-08-25 Thread Daniel Perry
t; To: Struts Users Mailing List > Subject: Re: download binary content > > > The difference between your implementation and mine is that I am not > setting the Cache-Control, Content-Disposition and Content-Length > headers. My download action seems to work fine in IE and Mozilla, but, >

Re: download binary content

2004-08-25 Thread Erik Weber
The difference between your implementation and mine is that I am not setting the Cache-Control, Content-Disposition and Content-Length headers. My download action seems to work fine in IE and Mozilla, but, could you enlighten me on what I may be sacrificing? Thanks, Erik Daniel Perry wrote: Bel

Re: download binary content

2004-08-25 Thread Stefan Groschupf
thanks a lot for all this hints! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: download binary content

2004-08-25 Thread Erik Weber
Basically, in your Action's execute method: response.setContentType("application/pdf"); File pdf = new File("/home/eweber/public/Foo.pdf"); InputStream in = null; OutputStream out = null; try { in = new FileInputStream(pdf); out = response.getOutputStream(); int bytesRead = 0; byte[] buffer = new b

Re: download binary content

2004-08-25 Thread James Mitchell
It's pretty simple, you set the content type to whatever you think/hope the client can handle. If their browser understands "application/vnd.ms-excel", the data written will be opened in Excel. See: http://www.javaworld.com/javaworld/javatips/jw-javatip94.html That article describes how to do i

RE: download binary content

2004-08-25 Thread Jesse Alexander (KXT)
No and Yes... No I have no url at hand... Yes: Basically you write directly to the response object (setting all headers as well, like mime-type...) AND then RETURN NULL at the end of the action's method Whenever you return null instead of a forward-object you signal to Struts, that you

RE: download binary content

2004-08-25 Thread Daniel Perry
Below is some code i wrote to do this. is some code i wrote: Note the doc object is specific to my app it has methods for returning the content type, filename, and a File object pointing to the document on disk. I have used almost identicle code for outputting pdf data. I think you can use "atta