Which is the best way to upload a file generated by my Google App Engine app to Google Storage? My GAE app is in java.
I tried to use JetS3t but it didn't work on GAE because it use threads.
Google APIs Java Client is a recommended way to access Google APIs from Java clients. There are examples for most APIs, but unfortunately not yet for Storage (the issue mentioned was resolved).
Related
I want a filesystem in the cloud to upload and download files with a java library.
I know Google Cloud Service has the service but i need one that have free storage until 2 ou 3 Gb.
Tks
For Google-specific solutions, Google Drive supports 15GB of free storage and supports Java (see their Java Example Drive App or Android Demos). Also, Google Cloud Storage supports a free trial, but otherwise charges per the price sheet, and also offers Java support through the Cloud Storage API Client Library for Java or third party toolkits, such as JetS3t.
There are also many non-Google cloud storage products, many of which have a free tier.
I am a C# developer who recently decided to venture into the mobile dev world specifically android dev using java. It has been a smooth ride until now. While I'm usually able to follow the tutorials on the android developers site and other sites easily, uploading an image/video to the app engine blobstore or cloud storage seems to be a bit over my head. I cant seem to wrap my head around the process.
I have already done the necessary steps to get my app running on app engine. I am able to register devices and save basic entities to the cloud but I cant seem to get any of the tutorials to work form me.
Basically my app allows users to take images or videos and then have them posted to my back end as part of a file sharing type of game.
I am not asking for someone to give me code that can accomplish this, instead pointing me to a very thorough tutorial would be great!
1.I need understand the role of a servlet (most examples use this for uploading to blobstore)
2.Where should the servlet reside?
3.Is there another way to do this without using a .jsp page for the file uploading ?
4. I have set up the app engine back end for my project including endpoints. Is there a way to send the images/video that way to the server and still be able to retrieve a serving url to fetch the image/video later?
I have been stuck on this for a week now and I'm getting quite discouraged as I cannot seem to adapt any of the tutorials that I have read to suite my needs. There are a few dark spots in my mind where the entire process is concerned. Since I am not familiar with java, servlets etc I'm stumbling in the dark and I just need a lamp to light my path. I think i'm just a step or two away.
BTW I have looked at these questions and tried the code suggested to no avail before deciding to post my own.
Upload to Appengine Blobstore in Android
BlobStore vs Cloud Storage for storing user uploaded images
Upload image from Android to Google Cloud Storage or Google App Engine Blobstore
Please help!
NOTE: I don't have an interface where the user gets to choose the image/video as it is to be taken directly from the camera and sent to the server(not sure that makes a difference).
You need to do a lot more reading. First understand servlets in general. Then learn how to use the blobstore or cloud storage api. Then read how to post directly to blobstore (not to the servlet) with a post-save servlet callback.
Welcome to the world of Java!
I'll try my best to explain the Servlets/JSPs part. I dont know a whole lot about Google app engine.
1) Servlets are nothing but Java objects but with more priveleges. Servlets know how to handle a web request! There are many things that come to mind when we talk about web request processing:
who maps the URL to this servlet?
Who gives this servlet user request parameters?
How can I guarantee only authorized users can access this servlet?
list goes on......
Answer to all above questions is a web container. And in the world of Java only one web container rules (others might differ): Apache Tomcat.
In short, servlets are Java objects created for you by Tomcat.
Where should the servlet reside?
They reside in Tomcat.
Is there another way to do this without using a .jsp page for the file
uploading ?
You dont need a JSP to send requests to a servlet. You can use jquery, python or anything else. As long as its a valid web request.
I have set up the app engine back end for my project including
endpoints. Is there a way to send the images/video that way to the
server and still be able to retrieve a serving url to fetch the
image/video later?
See the tutorial here. Especially 'Implementing Tweet My Picture' section.
Google app engine has Java API (along with python) and the best way to submit web request to that API using Java is servlets. That's why many example are in servlets. I think.
Here's what i would do if I were you:
Setup tomcat. There are many options. So reply if you are not sure.
Deploy your handler servlet that'll use Google app engine Java API.
Send your image files to blobstore (not the servlet). See the tutorial. App engine will forward blob related information to the handler servlet you created in step 2.
Use Blobstoreservice in that servlet so that users can access that uploaded image.
Let us know if this helped.
My java app generates some .png image which i want to store to any cloud storage through java API. I dont want any paid service if possible in free. Not getting a good answer for last 4 hours. Any suggestion?
Google Cloud Storage doesn't have a free tier, although for only a handful of PNG images you will likely be spending less than $1 per month.
Google Drive, however, is free for the first 15 GB or so (it's shared with your GMail account, your Google+ photos, etc). Google Drive also provides a Java API: https://developers.google.com/drive/quickstart-java
Dropbox and S3 also both have APIs and various quantities/time of free storage. If you're just looking to host images, and you're not trying to make money, and you don't need to host that many, you could look into image-specific services. Imgur.com, for example, provides an API.
Dropbox and Google Drive could meet your needs. You can download/upload files pragmatically to Dropbox and also to Google Drive. They have API to do it.
However, if you are really looking for really complete service where you can scale up your data storage until you want, you really want to take a look at Amazon S3. In fact, as far as I know, Dropbox works on the top of Amazon S3 to provide their services.
If you would like to have an idea about how to upload/download a file to Amazon S3, you can take a look to this application example. If you want the same thing on Dropbox or Google Drive, there are a lot of examples on Internet. However, on these two providers you need a token to upload files, what I don't like. I prefer the way in which it works for Amazon S3 (just for programming purposes - GUI is better on GD or Dropbox).
Amazon S3 is not totally free, but it is really, really cheap.
Be aware of the network latency between your app and your File storage provider if you don't use the same physical infrastructure.
Trying to download docs from the Google Docs using Java client library and getting some documents with type "externalapp".
What is this type and what is the proper way to handle such kind of files?
Those can be shortcuts created by third-party applications that integrate with Google Drive using the Drive SDK but store their data in a different storage system: https://developers.google.com/drive/apps_overview
I'm writing a program that will be hosted on GAE that can upload and process local files. The program needs to process the file on the server side, and then return it to the client side. Previously I used JFileChooser for that purpose, but found out that it's not supported in GAE. I did some research and found FileUpload class, but it seems like it can't return the data to the client side. I could just let the user type the path of the file, but that would be just bad usability.
Any ideas are appreciated! Thanks.
GAE may not support JFileChooser directly, but it is apparently possible to embed applets.
Since that is the case:
A digitally signed and trusted applet can show a JFileChooser.
A sand-boxed applet deployed in a Plug-In 2 architecture JRE (e.g. Sun's 1.6.0_10+) can be launched using Java Web Start and use the services of the JNLP API. The JNLP API offers the FileContents object by way of the FileOpenService. Here is a small demo. of the file services of the API.
You can't upload files to appengine in the conventional way. There is no filesystem. You have to serialize them into the datastore.