My Test case:
package controllers;
import java.io.*;
import play.mvc.*;
public class Application extends Controller {
public static void index() {
render();
}
public static void image() {
File f = new java.io.File("play.png");
renderBinary(f, "play_logo.png");
}
}
The output header is:
Content-Disposition: attachment; filename*=utf-8''play_logo.png;
filename="play_logo.png"
This header works great in firefox 3.5 and Safari
But failed in IE6 and Chrome (renames the file the last part of the
URI for instance httpl://localhost:9000/Apllication/image is just
image)
IE7 shows as an inline attachment
--
FIRAT KÜÇÜK
Which version are you using? Can you report a bug?
Thanks,
Nicolas
i am looking for the rfc docs.
http://www.faqs.org/rfcs/rfc2231.html
07 Ocak 2010 14:51 tarihinde Nicolas <leroux....@gmail.com> yazdı:
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
>
>
--
FIRAT KÜÇÜK
Or i did not succeed :)
Instead of this i try to send file directly via redirection.
sample routing:
/download/{id} will be redirected to /file/{id}/{fileName}
/download/5 -> /file/5/Setup.exe
But i did not find an appropriate play render method for direct file
content flush.
Those are the binary render methods that i noticed;
- renderBinary(File file) gives "Content-Disposition: inline" header.
- renderBinary(File file, String name) gives "Content-Disposition:
attachment" header.
Is there any method for file content flushing with appropriate MIME type?
07 Ocak 2010 15:02 tarihinde Fırat KÜÇÜK <firat...@gmail.com> yazdı:
--
FIRAT KÜÇÜK
08 Ocak 2010 13:41 tarihinde Fırat KÜÇÜK <firat...@gmail.com> yazdı:
--
FIRAT KÜÇÜK
> i think play needs some response.write methods.
> may be response.write(byte[] buf)
You can use:
response.out.write(byte[] buf)
2010/1/8 Fırat KÜÇÜK <firat...@gmail.com>:
You may try to define your own CDispo header before renderBinary call,
it won't be overriden by Play.
response.setHeader("Content-Disposition", "attachment; filename=\"" +
name+ "\"") ?
Hope this helps
On Jan 7, 1:49 pm, Fırat KÜÇÜK <firatku...@gmail.com> wrote: