Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobInfoFactory.loadBlobInfo()


  public static List<BlobInfo> loadBlobInfos(List<String> keyStrings) {
    BlobInfoFactory infoFactory = new BlobInfoFactory();
    List<BlobInfo> blobInfos = new LinkedList<BlobInfo>();
    for (String keyString : keyStrings) {
      log.info("getting blob");
      BlobInfo blobInfo = infoFactory.loadBlobInfo(new BlobKey(keyString));
      log.info("got blob");
      if (blobInfo == null) {
        log.severe("Could not load BlobInfo from BlobKey " + keyString);
        continue;
      }
View Full Code Here


      ArrayList<BlobKey> validSubmissionKeys = new ArrayList<BlobKey>();
      for (Entry<String, BlobKey> entry : blobs.entrySet()) {
        BlobKey blobKey = entry.getValue();

        BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);
        String contentType = blobInfo.getContentType().toLowerCase();
        long size = blobInfo.getSize();

        if (!contentType.startsWith("image/")) {
          blobstoreService.delete(blobKey);
View Full Code Here

       
        pmfUtil.persistJdo(photoSubmission);
        String submissionId = photoSubmission.getId();

        for (BlobKey blobKey : validSubmissionKeys) {
          BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey);

          PhotoEntry photoEntry = new PhotoEntry(submissionId, blobKey, blobInfo.getContentType());
          photoEntry.setOriginalFileSize(blobInfo.getSize());
          photoEntry.setOriginalFileName(blobInfo.getFilename());
         
View Full Code Here

        //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);
  }
}
View Full Code Here

        Iterable<Entity> results = pq.asIterable();
        for (Entity result : results) {
            Map<String, Object> upload = new HashMap<String, Object>();
            upload.put("description", (String) result.getProperty("description"));
            BlobKey blobKey = (BlobKey) result.getProperty("upload");
            upload.put("blob", blobInfoFactory.loadBlobInfo(blobKey));
            upload.put("uploadKey", KeyFactory.keyToString(result.getKey()));
            uploads.add(upload);
        }
               
        req.setAttribute("user", user);
View Full Code Here

public class Files extends MeApi {
 
  public static void serve(String key) throws LockException, IOException {
    BlobInfoFactory infoFactory = new BlobInfoFactory();
    BlobKey blobKey = new BlobKey(key);
    BlobInfo blobInfo = infoFactory.loadBlobInfo(blobKey);
    if(blobInfo==null) notFound();
    response.setContentTypeIfNotSet(blobInfo.getContentType());
    FileService fileService = FileServiceFactory.getFileService();
    AppEngineFile file = fileService.getBlobFile(blobKey);
    boolean lock = false;
View Full Code Here

        if (gsObjectName.contains("fake")) { //GCS Local File Upload Implementation is broken
            log.warning("Using hacked blobstore-gcs hybrid test because the local gcs implementation is broken");
            String blobKeyString = gsObjectName.substring(gsObjectName.indexOf("-") + 1, gsObjectName.lastIndexOf("-"));
            DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();
            BlobInfoFactory blobInfoFactory = new BlobInfoFactory(datastoreService);
            mimeType = blobInfoFactory.loadBlobInfo(new BlobKey(blobKeyString)).getContentType();

            ByteArrayInputStream bais = new ByteArrayInputStream(BlobstoreServiceFactory.getBlobstoreService().fetchData(new BlobKey(blobKeyString), 0, BlobstoreService.MAX_BLOB_FETCH_SIZE - 1));
            IOUtils.copyStream(bais, outputStream);
            outputStream.write("_123".getBytes());
        } else {
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.