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
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,
>
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
thanks a lot for all this hints!
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
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
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
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
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
8 matches
Mail list logo