DownloadLink for an external URL

2007-08-02 Thread gumnaam
I see that DownloadLink can be used to stream a File.

What I want to do is use DownLoadLink to redirect to  an external URL
that should be streamed (i.e. File Save box should pop up).

I can't use ExternalLink as the external URL's location is not pre determined,
also the external URL's location lookup is a costly so I don't want to do it 
unless
the User clicks on a link.

So in my case I do some thing like

class DownloadUrlLink {

 onClick() {

  URL externalUrl = getExternalURL(); //this is a costly operation, so I don't 
want to do it unless user clicks the Download link.
 getRequestCycle().setRequestTarget(new RedirectRequestTarget(url.toString()));
 
}

}

The URL points to a rather large gzipped XML file about 11MB in size.
But instead of popping up a File Save dialog, the browser starts to display the 
XML file.
and CPU usage jumps up to 100%, on account of the file being this large.

Is there a way to force the browser to pop up a FileSave dialog when using 
RedirectRequestTarget

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



Re: DownloadLink for an external URL

2007-08-02 Thread Igor Vaynberg
whatever streams that external file has to set a
content-disposition:attachment header so the browser pops up that box.

-igor

On 8/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I see that DownloadLink can be used to stream a File.

 What I want to do is use DownLoadLink to redirect to  an external URL
 that should be streamed (i.e. File Save box should pop up).

 I can't use ExternalLink as the external URL's location is not pre
 determined,
 also the external URL's location lookup is a costly so I don't want to do
 it unless
 the User clicks on a link.

 So in my case I do some thing like

 class DownloadUrlLink {

 onClick() {

   URL externalUrl = getExternalURL(); //this is a costly operation, so I
 don't want to do it unless user clicks the Download link.
 getRequestCycle().setRequestTarget(new RedirectRequestTarget(url.toString
 ()));

 }

 }

 The URL points to a rather large gzipped XML file about 11MB in size.
 But instead of popping up a File Save dialog, the browser starts to
 display the XML file.
 and CPU usage jumps up to 100%, on account of the file being this large.

 Is there a way to force the browser to pop up a FileSave dialog when using
 RedirectRequestTarget

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