本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例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