Updates:

For single files, use a small php script to get a file and set the headers
to download: {abbreviated for clarity}

xDL.php?type=pdf&file=mypdf&to=localname,
<?php
$type = $REQUEST['type'];
$from = $REQUEST['file'];
to = $REQUEST['to];
if($from==null||$to==null||file==null)die();//Don't try if not enough info
header('Content-type: application/'.$type);//Normally, this would switch for
mime types

header('Content-Disposition: attachment; filename=$from.'.',$type');


readfile($to.'.'.$type);
?>

For multiple files, pack them in a zip
<?php
$xHOME = "/home/username/public_html/";
$zip = new ZipArchive();
$filename = $HOME.'xAll.zip';//Arbitrary name

if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("cannot open <$filename>\n");
}

$ext = '.x';//Also arbitrary; I keep gwt xml files in a .x file so I can set
content type = text/plain for XmlParser

$xRes = scandir($xHOME);

foreach($xRes as $x)

if(substr($x,0,1)!='.'&&substr($x,($len=strlen($x))-strlen($ext),$len)==$ext)
            $zip->addFile($xHOME . $x.$ext);

$zip->close();

  header("Content-type: application/zip");
  header("Content-Disposition: attachment; filename=$filename");
  header("Pragma: no-cache");
  header("Expires: 0");
  readfile("$filename");

exit;
  ?>

The only problem is you {obviously} can't control where the file is
downloaded, but the plus is it's php.  I love java to death, but when it
comes to server side, it's expensive {financially and computationally for
intertwined reasons}, so having php scripts means your code will run on any
LAMP server {but not in GWT Hosted Mode}.  I guess it all boils down to what
kind of environment you want your code to run in.  If you want other
developers to be able to use your code, I'd go with php, cos it's
everywhere, it's faster than servlets, and it's easy to plug-in scripts
without worrying about web.xml and war structure...

-- 
"He whose desires are drawn toward knowledge in every form will be absorbed
in the pleasures of the soul, and will hardly feel bodily pleasure --I mean,
if he be a true philosopher and not a sham one." - Plato
"Wise Words Woven With Will Wakes Worlds" - Alyxandor Artistocles

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to