adarshmishra / java-blobstore-gcs-sample

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(Java) App Engine Blobstore API + GCS sample app

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):

Setup

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>

Running the app

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

About

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.

License:MIT License


Languages

Language:Java 100.0%