Yeah, those poor IE users will just have to read the "if your file did
not download, click here" message and do the download click themselves
if they stop the meta refresh ........ bah, IE ... hate it.
On Dec 20, 2008, at 3:48 PM, John Huss wrote:
Be careful, i think this pops up a warning in IE.
On Dec 20, 2008, at 10:19 AM, Kieran Kelleher <kieran_li...@mac.com>
wrote:
Susanne, that is brilliant!
What a simple solution that is very elegant from the user's point
of view ..... the thought never crossed my mind to use the Refresh
header to trigger a single download response on refresh! This is
exactly the kind of idea I was looking for and it works great while
providing the best user experience.
Rather than muck with http-equiv meta tags in my page wrapper, I
implemented your recommendation using the technique demonstrated by
Anjo in ERXLongResponse class whereby the Refresh header is
dynamically added in appendToResponse with a custom element sender
id appended to the end of the component context id and then in
invokeAction I use that sender id to capture the refresh and return
the download response .... this encapsulates all this download
functionality in the java file of the one WOComponent .....
awesome .... this is the cleanest long response download solution
by far.
FWIW, I have pasted code snippet below in case anyone else wants to
implement this for downloads that require a long response to
prepare the download file ..... see Anjo's ERXLongResponse class
for the Refresh-fiddling basis of this approach....
This approach uses one boolean,shouldDownloadOnRefresh(), to
trigger the download once....
Thanks again Suzanne for this simple effective idea. I like it a lot.
-Kieran
<snip>
private boolean _shouldDownloadOnRefresh = false;
/** @return whether to download the file using refresh aka 'meta
reload' */
public boolean shouldDownloadOnRefresh() {
return _shouldDownloadOnRefresh;
}
/** @param shouldDownloadOnRefresh whether to download the file
using refresh aka 'meta reload' */
public void setShouldDownloadOnRefresh(boolean
shouldDownloadOnRefresh){
_shouldDownloadOnRefresh = shouldDownloadOnRefresh;
}
/**
* We use our custom senderID key for the refresh to detect the
refresh
* and we call the download action that returns the download file
and we
* remove the refresh header
* @see
wk
.cheetah
.appserver
.WKPageComponent#invokeAction(com.webobjects.appserver.WORequest,
com.webobjects.appserver.WOContext)
*/
@Override
public WOActionResults invokeAction(WORequest request, WOContext
context) {
if (context.senderID().equals(WO_META_REFRESH_SENDER_ID)) {
return downloadTheFile();
}
return super.invokeAction(request, context);
}
/**
* We override so we can dynamically manage the META Refresh
header in the response
*/
@Override
public void appendToResponse(WOResponse response, WOContext
context) {
if (shouldDownloadOnRefresh()) {
response.setHeader(metaReloadResponseHeader(context),
REFRESH_HEADER_KEY);
// Toggle off so we don't download again
setShouldDownloadOnRefresh(
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/johnthuss%40gmail.com
This email sent to johnth...@gmail.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com
This email sent to kieran_li...@mac.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com