use of com.google.appengine.api.blobstore.BlobInfo in project teammates by TEAMMATES.
the class StudentProfilePictureUploadAction method extractProfilePictureKey.
private BlobInfo extractProfilePictureKey() {
try {
Map<String, List<BlobInfo>> blobsMap = BlobstoreServiceFactory.getBlobstoreService().getBlobInfos(request);
List<BlobInfo> blobs = blobsMap.get(Const.ParamsNames.STUDENT_PROFILE_PHOTO);
if (blobs == null || blobs.isEmpty()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_NO_PICTURE_GIVEN, StatusMessageColor.DANGER));
isError = true;
return null;
}
BlobInfo profilePic = blobs.get(0);
return validateProfilePicture(profilePic);
} catch (IllegalStateException e) {
/*
* This means the action was called directly (and not via BlobStore API callback).
* Simply redirect to ProfilePage.
*/
return null;
}
}
Aggregations