Hi,
try next:

response.setContentType("application/x-download");
response.setHeader(
"content-disposition",
"attachment;name=\""+downloadFileName+"\";filename=\""+downloadFileName+"\"");

for me - it's worked exellent in IE, Opera and Mozilla




Raj Saini wrote:

Hi David,

I tried it. It does not work.

Thanks,

Raj

On 4/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi,

try this code:

response.setContentType("binary/download");
response.setHeader("Content-disposition","attachment; filename=xxx.xxx");

before dump the content.


Best Regards,

David


-----Original Message-----
From: Raj Saini [mailto:[EMAIL PROTECTED]
Sent: Saturday, April 08, 2006 11:06 PM
To: Jetspeed Users List
Subject: Force downloading a file in JSF portlet

Hi,


I am building JSF based portlet for downloading a file using MyFaces JSF
bridge.
I do the following to make the file force download:

1) Set "content-disposition" header to contain the correct filename
2) Set "content-type" header to "application/octet-stream" or something more
accurate if the information is present in attachment metadata
3) Dump the content using a ServletOutputStream

When I click on the link to download the file, instead of throwing a dialog
box for saving/opening the file, browser dumps the the binary contents on
page. However, this works fine as standalone application.

Is there something extra I need to do to force download file in Jetspeed? Am
I missing something here?

Regards,

Raj




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Vladimir


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to