This app uses Blobstore API and Google Cloud Storage (GCS) to let users upload arbitrary file contents, display a list of all files, and serve uploaded contents using 3 different ways (for example purposes):
- using Images API
- creating a direct Request URI that points to GCS front-end
- using BlobstoreService.serve()
Create a new project on Google Cloud Console. For more info on Console see this: developers.google.com/console/help/new/
Note your Project ID. You'll need it later.
While you're in the console, go to Cloud Storage section and create a new bucket.
The bucket has to have Default Object ACL of public-read
, otherwise serving URLs
of files larger than 32Mb will not be accessible.
You can set Default Object ACL using gsutil
:
gsutil defacl set public-read gs://<my-bucket-name>
Clone the repo and optionally import it into your favorite IDE.
Open pom.xml
and update the Project ID in:
<appengine.app.id>my-app-id-goes-here</appengine.app.id>
Last thing is to set correct bucket name in UploadServlet:
public static final String GCS_BUCKET_NAME = "my-bucket-name-goes-here";
To upload the app execute mvn appengine:update
Once the deployment is complete, visit https://<my-project-id>.appspot.com
To see all the available goals for the App Engine plugin, run
mvn help:describe -Dplugin=appengine