Developing a web client without servlet - google-app-engine

I m new to appengine development.I have a few basic question about web client for appengine.When we make a google cloud module in Android Studio, an android client, a back end and a WEB CLIENT is auto-generated.A few files are auto-generated for web interface. My questions are:
why do I need WEB-INF/web.xml for web client? I also found there's a servlet api dependency added in gradle, though I didnt find and servlet file, what is it used for ?
I want to make a web interface/client for my andorid app, but I dont
know servlet,jsp, can I make it with pure javascript or js lib?
Will the default template for web client work from any other web-hosting
than appengine?
How can I make a web client with pure javascript,css,html, will the
google cloud doc for javascript suffice for this purpose?

why do I need WEB-INF/web.xml for web client? I also found there's a
servlet api dependency added in gradle, though I didnt find and
servlet file, what is it used for ?
Both are base elements for Java web applications even though you are not using servlets most modern web frameworks are built on top of them.
I want to make a web interface/client for my andorid app, but I dont
know servlet,jsp, can I make it with pure javascript or js lib?
Yes, GAE are standard web applications so you can build and app using pure HTML + js.
Will the default template for web client work from any other
web-hosting than appengine?
short answer, no. The App engine SDK depends on several APIs available strictly on the GAE environment. Shouldn't be hard to get an empty webapp template working on a tomcat thought.
How can I make a web client with pure javascript,css,html, will the
google cloud doc for javascript suffice for this purpose?
I dont know exactly what you mean by "the Google cloud Doc" but mostly the answer is yes, all App Engine, Cloud Compute and Google Drive are capable of hosting HTML+JS.

Related

Deploy non-web Java application

I have a relatively small Java app, which I'd like to move over to the Google App Engine. It runs in the console, with no user input needed after the initial startup. I researched a bit on how to deploy it, but all tutorials seem to focus on Java web apps, when I don't really need that. Is it possible to deploy my app if it's not a web app?
App Engine is probably the wrong GCP platform for you - you'd probably be better served just deploying your jar directly onto a Google Compute Engine node. GAE is pretty explicitly oriented around web applications and you'd need to do a bunch of configuration in order to have it work for your use case.
Does your non-web Java app handle web requests? If not, it seems difficult to imagine that you would be able to reach your deployed app and use it for any purpose, once deployed. Your Java app should be able to handle requests, to make deployment worthwhile, and the deployed app useful.
You may find out about how your app should handle requests by reading the How Requests are Handled documentation page.

What is the difference between app engine and cloud endpoints when developing with Android studio?

I've been trying to do this for a while, but I'm confused as to the difference between the two applications.
I know that endpoints helps you expose an API and generate the client libraries that allow you to interact with your Android app.
But in the examples, it seems as though endpoints is the only code you write for the backend at all.
I thought that app engine was what the actual application ran on - that is, do I need a separate project with the app engine backend, then my android studio project with the Android app and the endpoints API, or does writing the endpoints API also serve as the app engine backend?
The endpoints backend API is just a piece of a GAE app functionality.
If you only have that functionality in your app you can extend it by adding the desired stuff to the existing app.yaml file (and the related app code), you don't have to create a new app. Especially if the endpoints functionality and the additional desired functionality are related.
You can also add endpoints backend support to an existing GAE app by merging the endpoints backend app.yaml content into the existing app's app.yaml file and adding the class file and API server file to the app's code.

JAX-RS services in Google App Engine

I'm developing a Google App Enigne application that uses some REST services and offers in turn web services. I'm using the GAE Eclipse plugin. I have 2 questions:
What is the best JAX-RS library to use with GAE nowadays? I'd like to use Jersey because I understand is the most "standard" library (isn't it?), but I could use any in principle... I've been looking for documentation, but I've only found some samples in blogs that only work with old versions of Jersey, etc...
For the web services I have to offer, I thought of using JAX-RS as well, but now I'm not sure if it's the best option...
You can use Jersey 1.5. You can see all frameworks that will play on GAE at http://code.google.com/p/googleappengine/wiki/WillItPlayInJava
But GAE has realized on version 1.7.5 as experimental service Endpoints which in term are rest service. Check https://developers.google.com/appengine/docs/java/endpoints/
For web service I don't know if you mean soap service..JAX-RS is the specification for rest service, instead you should use JAX-WS I don't try the compatibility with this specification.
After a little research on this subject, I've found out that the best way to offer web services from Google App Engine is using Google Cloud Endpoints, which is still an experimental technology but as far as I've tried, it works well. Furthermore it is very well integrated with GAE and the Google Plugin for Eclipse.
To cosume REST services from Google App Engine, I've opted for using just Java build-in HTTP client library as explained here. I don't know if it's the best way, but it is very simple and you avoid compatibility problems that could arise between GAE and JAX-RS APIs such as Jersey.
In order to work with JSON in GAE (very useful for RESTful services), I'm using Google's gson, which is a Java library that can be used to convert Java Objects into their JSON representation and vice-versa.

GWT and Google Docs API

I'm using GWT to create a simply app that allows teachers to create easily their own lessons.
The App is going to be on Google App Engine but I want to store lessons in user's Google Docs space .
Is it possible?
As far as I know gwt transforms java into javascript but google docs api is java, do i have to upload the java library to de app engine storage?
any place to start? any advice?
Thanks...
You need server side proxy for GWT client.
Your GWT client communicates with the servlet. The servlet is the actual agent using the google docs API.
Please read my explanation at http://h2g2java.blessedgeek.com/2010/05/accessing-google-userservice-from-gwt.html.
It explains how to get a GWT client could communicate with a Java based Google API. It explains that since GWT requires all Java source involved to be available to the GWT compiler, there are cases that you simply cannot get GWT client to do the task directly.
http://h2g2java.blessedgeek.com/2009/08/tablemgr-gae-gwt-gdata-with-rpc.html similarly explains how to combine gae + gwt + google docs, using the proxy approach. The posting is quite old and therefore the web site it points to does not work anymore because I have not updated the gae app with google mandated authentication measures. But it should work on your local machine.
The above subscribes to a webserver flow paradigm.
However, Google APIs are essentially REST APIs, which allows you to access them directly using your javascript or GWT client. So, instead of using the Java docs for Google APIs, you need to read the Google REST API docs.
http://code.google.com/more/, among other whatnots, provides a list of all the Google cloud APIs. To avoid using the webserver-proxy flow paradigm, choose the javascript or REST version of the API docs.
Here is the google docs/data API:
http://code.google.com/apis/gdata/docs/client-libraries.html.
Choose the javascript API:
http://code.google.com/p/gdata-javascript-client/
I advise you to first practice using these APIs by coding in javascript. Then you would get a good grasp of what you need to do in GWT.
You should use the GWT API for authentication prior to accessing the Google REST APIs.
http://code.google.com/p/gwt-oauth2/.
Essentially, you are obtaining an authenticated token which your client could use to access Google's data thro their REST APIs.
FYI, REST APIs are, in plain speak, URLs in a defined specification, where data transmission is by convention mostly in JSON or XML.

Does Google App Engine Support JAVA Proxy API's?

I have a question surrounding the REST service. I have an application written in C# , i want to put this application onto the cloud. I have a small problem, My Application has a built in C# API. I want to interact with my application and Google app engine. I want to develop a JAVA PROXY on top of GAE so that it can interact with my application using REST protocol and performs CRUD operations on Cloud and returns back data to my application.
Is it possible to do this ? to what i know is that SANDBOX feature doesn't allow us to directly interact with the App Engine.
Any suggestion on this.........
Thanks Heaps
Suraj
You don't need Java Proxy API in order to make http requests to another server (I guess you did not have java's Proxy class in mind?).
Yes, AppEngine can make HTTP/REST requests to other servers via URL Fetch java API.

Resources