当前位置: 首页>>代码示例>>Java>>正文


Java UploadOptions类代码示例

本文整理汇总了Java中com.google.appengine.api.blobstore.UploadOptions的典型用法代码示例。如果您正苦于以下问题:Java UploadOptions类的具体用法?Java UploadOptions怎么用?Java UploadOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UploadOptions类属于com.google.appengine.api.blobstore包,在下文中一共展示了UploadOptions类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatchUploadForm

import com.google.appengine.api.blobstore.UploadOptions; //导入依赖的package包/类
protected void dispatchUploadForm(
        HttpServletRequest req,
        HttpServletResponse resp, 
        String errorMsg
) throws ServletException, IOException {
    UploadOptions opts = UploadOptions.Builder
            .withGoogleStorageBucketName(GCS_BUCKET_NAME);
    String uploadUrl = blobstore.createUploadUrl("/upload", opts);

    req.setAttribute("uploadUrl", uploadUrl);
    if (errorMsg != null) {
        req.setAttribute("error", errorMsg);
    }

    req.getRequestDispatcher("/WEB-INF/upload-form.jsp").forward(req, resp);
}
 
开发者ID:x1ddos,项目名称:java-blobstore-gcs-sample,代码行数:17,代码来源:UploadServlet.java

示例2: parseOptions

import com.google.appengine.api.blobstore.UploadOptions; //导入依赖的package包/类
protected UploadOptions parseOptions(HttpServletRequest request) {
    UploadOptions options = UploadOptions.Builder.withDefaults();

    String maxPerBlob = request.getParameter("max_per_blob");
    if (maxPerBlob != null) {
        options.maxUploadSizeBytesPerBlob(Long.parseLong(maxPerBlob));
    }

    String maxAll = request.getParameter("max_all");
    if (maxAll != null) {
        options.maxUploadSizeBytes(Long.parseLong(maxAll));
    }

    String bucketName = request.getParameter("bucket_name");
    if (bucketName != null) {
        options.googleStorageBucketName(bucketName);
    }

    return options;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:21,代码来源:UploadUrlServerServlet.java

示例3: getCsUploadURL

import com.google.appengine.api.blobstore.UploadOptions; //导入依赖的package包/类
@ApiMethod(
        name = "getCsUploadURL",
        path = "getCsUploadURL",
        httpMethod = ApiMethod.HttpMethod.POST
)
@SuppressWarnings("unused")
public GetCSuploadURLreturn getCsUploadURL(User googleUser) throws Exception {

    CryptonomicaUser cryptonomicaUser = UserTools.ensureCryptonomicaRegisteredUser(googleUser);
    //
    String imageUploadUrl = BlobstoreServiceFactory.getBlobstoreService().createUploadUrl(
            "/cs-user-image-upload",            // upload handler servlet address
            UploadOptions.Builder.withGoogleStorageBucketName(
                    Constants.GAE_PROJECT_DOMAIN // Cloud Storage bucket name (f.e. "cryptonomica-test.appspot.com")
            )
    );
    String imageUploadKey = randomAlphanumeric(9);
    //
    cryptonomicaUser.setImageUploadLink(imageUploadUrl);
    cryptonomicaUser.setImageUploadKey(imageUploadKey);
    //
    Key<CryptonomicaUser> cryptonomicaUserKey = ofy().save().entity(cryptonomicaUser).now();
    LOG.warning("Upload URL: " + imageUploadUrl);
    LOG.warning("Saved for user: " + cryptonomicaUserKey.getName());
    LOG.warning("With imageUploadKey: " + imageUploadKey);

    return new GetCSuploadURLreturn(imageUploadUrl, imageUploadKey, null);
}
 
开发者ID:Cryptonomica,项目名称:cryptonomica,代码行数:29,代码来源:UploadAPI.java

示例4: getNewUploadUrl

import com.google.appengine.api.blobstore.UploadOptions; //导入依赖的package包/类
/**
 * Creates and invokes a URL for uploading a large blob to Google Cloud Storage.
 * Upon completion of the upload, a callback is made to the specified {@code callbackUrl}.<br>
 * Refer to {@link com.google.appengine.api.blobstore.BlobstoreService#createUploadUrl}.
 */
public static String getNewUploadUrl(String callbackUrl) {
    UploadOptions uploadOptions =
            UploadOptions.Builder.withDefaults()
                         .googleStorageBucketName(Config.GCS_BUCKETNAME)
                         .maxUploadSizeBytes(Const.SystemParams.MAX_FILE_LIMIT_FOR_BLOBSTOREAPI);

    return BlobstoreServiceFactory.getBlobstoreService()
                                  .createUploadUrl(callbackUrl, uploadOptions);
}
 
开发者ID:TEAMMATES,项目名称:teammates,代码行数:15,代码来源:GoogleCloudStorageHelper.java

示例5: getUploadUrl

import com.google.appengine.api.blobstore.UploadOptions; //导入依赖的package包/类
public String getUploadUrl() {
  BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
  UploadOptions uploadOptions = null;
  String bucket = configManager.getGoogleStorageBucket();
  if (bucket == null || bucket.isEmpty()) {
    uploadOptions = UploadOptions.Builder.withDefaults();
  } else {
    uploadOptions = UploadOptions.Builder.withGoogleStorageBucketName(bucket);
  }
  return blobstoreService.createUploadUrl(configManager.getUploadHandlerUrl(), uploadOptions);
}
 
开发者ID:GoogleCloudPlatform,项目名称:solutions-photo-sharing-demo-java,代码行数:12,代码来源:PhotoServiceManager.java


注:本文中的com.google.appengine.api.blobstore.UploadOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。