Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobstoreService.serve()


  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws IOException {
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
    BlobKey blobKey = new BlobKey(req.getParameter("blob-key"));
    // Writes the file bytes into the response
    blobstoreService.serve(blobKey, res);
    String filename = BlobstoreUtil.getFilename(blobKey);
    log.info("Serving " + blobKey.getKeyString() + " as " + filename);
    res.setHeader("Content-Disposition","attachment;filename=" + filename);
  }
}
View Full Code Here


    GcsFilename fileName = getFileName(req);
    if (SERVE_USING_BLOBSTORE_API) {
      BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
      BlobKey blobKey = blobstoreService.createGsBlobKey(
          "/gs/" + fileName.getBucketName() + "/" + fileName.getObjectName());
      blobstoreService.serve(blobKey, resp);
    } else {
      GcsInputChannel readChannel = gcsService.openPrefetchingReadChannel(fileName, 0, BUFFER_SIZE);
      copy(Channels.newInputStream(readChannel), resp.getOutputStream());
    }
  }
View Full Code Here

                // Leave blobKey null.
            }
        }
       
        if (blobKey != null) {
            bs.serve(
                    blobKey,
                    bs.getByteRange(req),
                    resp);
        } else {
            resp.sendError(404);
View Full Code Here

          .getBlobstoreService();
      BlobKey key = (BlobKey) readed.getProperty(BLOBKEY_PROP);
      //System.out.println("STORE (key): " + key);
      if (resp != null) {
      //  System.out.println("STORE (key): resp != null");
        bss.serve(key, resp);
      }
    }

  }
View Full Code Here

    @Override
    public Navigation run() throws Exception {
        String keyName = asString("keyName");
        BlobKey blobKey = new BlobKey(keyName);
        BlobstoreService bs = BlobstoreServiceFactory.getBlobstoreService();
        bs.serve(blobKey, response);
        return null;
    }
}
View Full Code Here

   
    switch(path.getType()) {
    case BLOBSTORE_BLOB:
      BlobstoreService blobstore = BlobstoreServiceFactory.getBlobstoreService();
      BlobKey blobKey = new BlobKey(path.getKeyStr());
      blobstore.serve(blobKey, resp);
      break;
    case DATASTORE_BLOB:
    case DATASTORE_TEXT:
      DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
      Key key = KeyFactory.stringToKey(path.getKeyStr());
View Full Code Here

        String blobRange = request.getParameter("blobRange");
        String blobRangeString = request.getParameter("blobRangeString");

        BlobKey key = new BlobKey(blobKey);
        if (range != null) {
            service.serve(key, range, response);
        } else if (blobRange != null) {
            service.serve(key, new ByteRange(Long.parseLong(blobRange)), response);
        } else if (blobRangeString != null) {
            service.serve(key, blobRangeString, response);
        } else {
View Full Code Here

        BlobKey key = new BlobKey(blobKey);
        if (range != null) {
            service.serve(key, range, response);
        } else if (blobRange != null) {
            service.serve(key, new ByteRange(Long.parseLong(blobRange)), response);
        } else if (blobRangeString != null) {
            service.serve(key, blobRangeString, response);
        } else {
            service.serve(key, response);
        }
View Full Code Here

        if (range != null) {
            service.serve(key, range, response);
        } else if (blobRange != null) {
            service.serve(key, new ByteRange(Long.parseLong(blobRange)), response);
        } else if (blobRangeString != null) {
            service.serve(key, blobRangeString, response);
        } else {
            service.serve(key, response);
        }
    }
}
View Full Code Here

        } else if (blobRange != null) {
            service.serve(key, new ByteRange(Long.parseLong(blobRange)), response);
        } else if (blobRangeString != null) {
            service.serve(key, blobRangeString, response);
        } else {
            service.serve(key, response);
        }
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.