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.
Related
I have a Java Spring Boot web app which should allow the users to upload their videos. I did some researches and I found that JWPlayer is the best solution in this way.
I would like to upload videos to JWPlayer and store in a database the id of the uploaded video related to a particular user.
The only problem is that the documentation is not so clear, and I don't understand how can I interact with JWPlayer with my Spring Boot back end.
There is just this page which does not show any code nor give any intuition of the process.
JWPlayer doesn't provide a Java or Spring Boot integration, but it does have APIs that you can call from Java. The steps go as follows:
Create your video metadata by calling /v1/videos/create. I highly recommend using the S3 upload method. If you're not sure how to make this call you can read about the call structure and authentication
Upload your video by using the link returned in the create call. You can read more about how to do this here if you do the S3 method, or here otherwise.
There is a pretty good example of how this entire process goes written in Python on the page you linked.
If you're uploading videos on behalf of your users, it'd probably be easiest to do this on the frontend with JavaScript instead of proxying through your Java application
I asked this question before but it was unanswered for a week or so I think so I decided to ask again but with a different formula.
I have a JFX desktop app. one of the features of one of the modules contains a video upload to the server. I searched this around a lot but the solutions I found are in two categories
using servlet / jsp on the server and service in the desktop app
copying the file locally (not what I want)
now I am ok with havign a service doing it the upload that's what I expect but I dont see the need of having a deployment on the server plus I already have a webapp. Is it possible to just have a webservice in the server and call it in the desktop app code? I haven't found anything on this.
Yes, it's possible and preferable choice.
The potential solution I see would be:
deploy a file REST service on your File server where the videos would be held.
Example Rest service in Java: https://github.com/polopolyps/fileserver
Then in your java FX application you simply send user file (a video) using REST lib, see: http://square.github.io/retrofit/
and Voila you have your functionality.
I want to write a client application for a site (e.g. to read smth from site, add some comments, likes etc). I haven't got access to site sources and there isn't any API for work with it. So at my Android application I decided to parse this site (it has static pages) using : JSOUP Library
And using this library I'm going to write unofficial, but API for my purposes to work with this site, and then use it in my Android application.
Can somebody tell me, is this good practice or there are better ways to do? Is this good idea at all to parse site in Android device.
As I wrote in comment - in general building your own application on top of the third party www service is not a good idea. If you want to do it anyway you have 2 options:
Use jSoup (or any other html parser if exists) and parse third party content on the device
Set up some middleware server to parse content and serve it in some more convenient way.
The second option has a little advantages - you can fix application without forcing users to update it and probably you'll save a bit of device's bandwidth. Of course disadvantage is that you have to pay for server.
General problem with applications like that is that every single change with layout, skin, server configuration can cause your application to stop working, as well as parsing html needs much more work that just connect to existing API.
More over - publishing your application can cause some legal issues (copyright) and is against Google Play's policy:
Do not post an app where the primary functionality is to: Drive
affiliate traffic to a website or Provide a webview of a website not
owned or administered by you (unless you have permission from the
website owner/administrator to do so)
I searched a lot regarding this topic but did not get any good answer.
Scenario:
We have Rest web service bases implementation in our project. Ideally frontEnd (Flex) call web service and backend send huge data point to frontEnd. Then frontEnd create chart of these data points and display to end user.
Our requirement is that user can export these charts and save as pdf file on the server. We are able to create JPG file from flex server and save as pdf file.
Problem occurs when end user has scheduled that chart report. Now that report can run at any time and may be browser is not opened at that time. So how backEnd will interact with frontEnd (flex) functions. Problems are:
browser is not opened so swf file is not loaded.
java/jsp need to interact with frontEnd(flex) as a reverseAjax so that frontEnd send JPG file back to server.
Does anybody face this issue before?
Is it somehow possible??
Asnwers/any leads are highly appreciated.
Please provide comments on this
Probably the only way to do this is to run a version of your Flex application (at least the charting part) on your server, and have your Java server interact with it.
I have faced a similar problem and have asked a similar question before. It is not very elegant, but what I mentioned before seems to be the only way to go.
I have the following questions which I have researched a lot on Google as well as in SO but found nothing::
I have to create a Native Android Application of a Magento based Site, and I have to use the same database of Magento Site. Now, I have found that we can't Access the PHP files of the Magento project as the access is denied. So how to call a Magento Login Function from the Android Client?
I have come to know that we have to call the function through using XML-Connect file in Magento. Please any one can give me a Example how to call that file and how?
Last Parsing. Which parser would be more handy? (DOM, SAX, SIMPLE XML Serialization parser?)
How to manage the Sessions with the Magento Store So that the user can add to cart items and could do Online Transaction.
Anyone who has worked on Magento Site's App Development provide some direction to move further. I am totally lost and getting nothing from the Online Research.
Any help would be highly Appreciated.
And Regards.
I've not worked with Magento site. But I've worked with similar websites to connect to the mobile applications.
Short Answer: XML-Connect is the best way to minimize your work. And its easy to use API than connecting to the database using php files. For mobile applications, it is always advisable to use a simple xml format, however, in your case, you have to stick to xml-connect's protocol.
For some more information, see this link http://inchoo.net/ecommerce/magento/develop-your-own-magento-mobile-application/