Discussion:
DownloadLink for an external URL
g***@cox.net
2007-08-02 16:05:20 UTC
Permalink
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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions.
Igor Vaynberg
2007-08-02 16:10:34 UTC
Permalink
whatever streams that external file has to set a
content-disposition:attachment header so the browser pops up that box.

-igor
Post by g***@cox.net
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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
This mailing list is shutting down. Please subscribe to the Apache Wicket
user list. Send a message to: "users-subscribe at wicket.apache.org" and
follow the instructions.
_______________________________________________
Wicket-user mailing list
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions.
Gumnaam
2007-08-02 17:02:04 UTC
Permalink
thanks for the response,
If I type in the external URL in the browser's address bar, then I do
get the file save dialog box.
So I presume that the external server, is indeed setting the desired header.
but when I redirect to that URL from within a wicket application, I
can't seem to get the
save dialog box.

I'll try and capture headers in both cases, and compare.
I suppose me setting the header on the web response object, and then
redirecting
won't do any good.

I can construct a URL resource stream target from the external url and
use that
instead of RedirectRequestTarget, but that would mean, processing that
11MB of file,
thru the wicket application, which I want to avoid.

thanks
Post by Igor Vaynberg
whatever streams that external file has to set a
content-disposition:attachment header so the browser pops up that box.
-igor
Post by g***@cox.net
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: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org

Loading...