System.out.println("Received a request to serve a blob with the id: " + req.getParameter("id")
+ ", and file: " + req.getParameter("file"));
HUDXML3BlobService hxbs = new HUDXML3BlobService();
HUDXML3Blob b = hxbs.getHUDXML3Blob(req.getParameter("id"));
int requestedfileNumber = Integer.valueOf(req.getParameter("file"));
BlobKey blobKey;
switch (requestedfileNumber) {
case 1: blobKey = new BlobKey(b.getCsvUrl1());
break;
case 2: blobKey = new BlobKey(b.getCsvUrl2());
break;
case 3: blobKey = new BlobKey(b.getCsvUrl3());
break;
case 4: blobKey = new BlobKey(b.getCsvUrl4());
break;
case 6: blobKey = new BlobKey(b.getCsvUrl6());
break;
default: blobKey = new BlobKey(b.getCsvUrl1()); }
//BlobKey blobKey2 = new BlobKey("wWN4LMO8okJ-zlmkdQk8Bg");
//System.out.println("overriding returned key:" + blobKey.getKeyString() + " with static key: " + blobKey2.getKeyString());
System.out.println("sending blob key: " + blobKey.getKeyString());
resp.setContentType("application/x-download");
BlobInfoFactory bif = new BlobInfoFactory();
String fileName = bif.loadBlobInfo(blobKey).getFilename();
resp.setHeader("Content-Disposition", "attachment; filename=" + fileName);
blobstoreService.serve(blobKey, resp);