com.google.appengine.api.blobstore.UploadOptions Java Examples

The following examples show how to use com.google.appengine.api.blobstore.UploadOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadUrlServerServlet.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: PhotoServiceManager.java    From solutions-photo-sharing-demo-java with Apache License 2.0 5 votes vote down vote up
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);
}