Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobKey


    RightsManagementController rightsController = RightsManagementController
        .getInstance();
    BlobstoreService blobstoreService = BlobstoreServiceFactory
        .getBlobstoreService();
    Map<String, BlobKey> blobs = blobstoreService.getUploadedBlobs(req);
    BlobKey blobKey = blobs.get("upload");
    if (blobKey == null) {
      redirect(res, blobKey);
      return;
    }
View Full Code Here


  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    // TODO Auto-generated method stub
    String imageID = getParameter(req, PARAMETER_IMAGE);
    BlobKey blobKey = new BlobKey(imageID);
        blobstoreService.serve(blobKey, resp);
  }
View Full Code Here

        .getBytes()));
      entity.setProperty("Text", new Text(RandomStringUtils.randomAlphanumeric(1000)));
      entity.setProperty("ShortBlob", new ShortBlob(RandomStringUtils
        .randomAlphanumeric(500)
        .getBytes()));
      entity.setProperty("BlobKey", new BlobKey(RandomStringUtils.randomAlphanumeric(10)));

      // Make Null Property
      if (keyList.size() == 0) {
        Iterator<String> iterator = entity.getProperties().keySet().iterator();
        while (iterator.hasNext()) {
View Full Code Here

    String key = req.getParameter("blob_key");
    if (StringUtils.isBlank(key)) {
      sendError(res, "未提供blob_key");
      return;
    }
    BlobKey blobKey = new BlobKey(key);
    if (null == blobKey.getKeyString()) {
      sendError(res, "不合法的blob_key:" + key);
      return;
    }
    blobstoreService.serve(blobKey, res);
  }
View Full Code Here

        return;
      }
    }

    List<BlobKey> blobs = blobstoreService.getUploads(req).get("myFile");
    BlobKey blobKey = blobs.get(0);
    if (null == blobKey) {
      sendError(res, "無法正常儲存上傳的檔案");
      return;
    }

    ImagesService imagesService = ImagesServiceFactory.getImagesService();
    ServingUrlOptions servingOptions = ServingUrlOptions.Builder.withBlobKey(blobKey);

    String servingUrl = imagesService.getServingUrl(servingOptions);

    res.setStatus(HttpServletResponse.SC_OK);
    res.setContentType("application/json");

    // 二種方式都能存取上傳的圖檔
    JSONObject json = new JSONObject();
    // json.put("serving_url", servingUrl);
    // json.put("blob_key", blobKey.getKeyString());
    // json.put("direct_url", "/serve?blob_key=" + blobKey.getKeyString());

    // 儲存在db的動作
    DeviceUpload du = new DeviceUpload();
    du.setDevID(devID);
    du.setMySerial(mySerial);
    du.setServing_url(servingUrl);
    du.setBlob_key(blobKey.getKeyString());
    du.setAddTime(CTCommon.getNowTime());
    du_service.add(du);
    log.info("新增一筆設備上傳記錄:" + JSON.toJSONString(du));

    // 直接新增message info到db
View Full Code Here

                HttpServletResponse response,
                @PathVariable("blobKeyString") String blobKeyString
                ){

    try {
      BlobKey blobKey = new BlobKey(blobKeyString);
      BlobstoreServiceFactory.getBlobstoreService().serve(blobKey, response);
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

      crop=true;
    }

    try {
      String urlResizedImage;
      BlobKey blobKey = new BlobKey(blobKeyString);

      urlResizedImage = ImagesServiceFactory.getImagesService().getServingUrl(blobKey, width, crop);
      response.sendRedirect(urlResizedImage);
    } catch (Exception e) {
      response.sendRedirect(iPicasaWeb.getImageUrl(ApplicationConstants.NO_IMAGE_TITLE));
View Full Code Here

        .getBytes()));
      entity.setProperty("Text", new Text(RandomStringUtils.randomAlphanumeric(1000)));
      entity.setProperty("ShortBlob", new ShortBlob(RandomStringUtils
        .randomAlphanumeric(500)
        .getBytes()));
      entity.setProperty("BlobKey", new BlobKey(RandomStringUtils.randomAlphanumeric(10)));

      // Make Null Property
      if (keyList.size() == 0) {
        Iterator<String> iterator = entity.getProperties().keySet().iterator();
        while (iterator.hasNext()) {
View Full Code Here

      .randomNumeric(7)));
    entity.setProperty(GbProperty.EMAIL, new Email(RandomStringUtils.randomAlphanumeric(20)));
    entity.setProperty(GbProperty.IMHANDLE, new IMHandle(
      Scheme.valueOf("sip"),
      RandomStringUtils.randomAlphabetic(2)));
    entity.setProperty(GbProperty.BLOB_KEY, new BlobKey(RandomStringUtils
      .randomAlphanumeric(10)));

    List<String> coll = new ArrayList<String>();
    coll.add(RandomStringUtils.randomAlphabetic(3));
    coll.add(RandomStringUtils.randomAlphabetic(3));
View Full Code Here

  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

TOP

Related Classes of com.google.appengine.api.blobstore.BlobKey

Copyright © 2018 www.massapicom. 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.