Google App Engine (Java) web service authentication/authorization/security - java

I currently have a Google App Engine app consisting of two parts:
A website using old school JSPs
A RESTful service implemented in Jersey
I've been trying to figure out how to shoehorn authentication into the web service but am rather lost since I've never used Spring before, and it sounds like that's the way to go.
Must I use Spring, or can I use Java EE? Are there any examples of how to accomplish this with Google App Engine?
Also, if I can get a high level description of some best practices for securing web services, that would be cool.
Thanks
Mark

app engine has built in OAuth support, which should do what you want.

I recomend you use apache shiro instead of spring because performance more over if you haven't got experience with spring. Apache shiro is a security framework and it could be integrated with GAE. You also can find a example in githubhow integrate the framework in GAE with Guice library.
Anyway for use Spring in GAE you also can find same best practice on Google Cloud Platform documentation

Related

How do i link android app with web app using REST/HTTP

I am new here. I would need some advice on this issue.
I have a well developed java web application deployed on openshift and connected with mySQL.
i am new in android development. Currently, i have to develop an native android application that talks to my openshift application for the data in mySQL. I understand that to do this, i have to create a RESTful web service on my web app and my android application would call the web service.
My questions would be
1. Where can i get started to develop a restful web service, is there any simple-to-understand resources to get me started? I understand that creating a restful web service from scratch would be tedious and having a framework will help in creating a web service better. Please advice me on this
Is there any sample projects/tutorial out there that guide me how to write a restful api to link between my web app and android app?
To create a restful web service, it is using json to parse the information over, is there any guide on this? I'm not very good at json. Would be good if there is an tutorial
Thank you for the guidance in advance! Feeling lost on how to get it started despite reading the getting started on android 1001 times!
If your code is in Java, I suggest you look into Spring MVC framework. Its one of the widely used frameworks for Java.
You could look into Volley examples here.
Volley is recommended for HTTP calls in Android.
To create JSON response to be sent by your server, you could look into Google's GSON library. To parse JSON web response into Java objects in your Android code, you could use any of the ORMs. GreenDAO is a stable open-source library for this purpose.

Set up web services based environment (advice/tips to start)

I am a bit lost because it's my first time assuming this role for a project.
We are making a software which consists in an app developed in Phonegap (for making a service oriented architecture, to make multiplatform easier).
The Phonegap app (and also the admin web) will be consuming constantly web services (every functionality is a service), and is my task to set up and environment to publish the API with the different services. I have heard about JAX-RS and also Spring MVC (I prefer this last option, because the good integration with Tomcat, and knowledge on the framework).
I have more or less clear the architecture (Tomcat+Spring+WebServices), but I am not sure how to start, because of the integration with the mobile app. I obviously want to develop with Java in the server side.
Any advice to start or related?
Thanks too much to all.
I would suggest you go for Apache CXF support for Rest Service.You can deploy the same in a tomcat server.I will suggest you to read the following URLs for better understanding:
http://www.dreamsyssoft.com/blog/blog.php?/archives/7-Simple-JAX-RS-Web-Service-in-Java-with-Spring-and-CXF.html
http://cxf.apache.org/docs/restful-services.html
Hope this helps.

Application on Google App Engine with Web and RESTful interface

I'm learning to use the Google App Engine for a project.
I've created a sample web application with the java sdk, in which all the business logic is in the servlets.
Where should be right to put the business logic if I want also to expose the application functionalities through a RESTful web service (which I understood that is possible with additional framework as Restlet)?
There is any development framework that can help me in this?
Right place to put the business logic would certainly not be servlets. You should put logic in service, and data access classes. Be careful while choosing a framework on GAE as cold start may hurt badly. As for REST framework on GAE, RESTlet has gained some positive response.
Refer RESTful application on Google App Engine Java?
and Implementing REST Service (JSON) on Google AppEngine

Restlet vs Spring MVC for Restful web service

I'm researching how best to create a Restful web service on Google app engine. My end goal is to have an Android application call a web service on GAE to post and get data. At this point I not sure what the best approach is.
What I know at this point is Spring MVC 3 provide the ability to create web service but it does not provide a full implementation of JAX-RS. I also have read a few blog that talk about how Spring and Restlet can be integrated together. On the other side I have read that I could only use Restlet in GAE. I would also like provide a light web interface for users to view their posted data
So my questions are the following.
1. Should I just use Restlet.
2. Should I just use Spring MVC to provide my Restful web service.
3. Should I use Spring and Restlet together.
At this point I think I should invest my time in Restlet because that seems to be the best approach for calling web services in Android. I'm also debating if Spring MVC is just over kill.
Any thoughts would be helpful.
Have a look at the following similar questions:
Easiest frameworks to implement Java REST web services and Can anyone recommend a Java web framework that is based on MVC and supports REST?
I recently set up RESTlet on GAE and it was an absolute breeze! There are docs outlining the procedure on the RESTlet website and I was up and running RESTlet on GAE using the Google datastore within two hours.
The major downside is that performance of the Google data store for low volume apps is atrocious. Timeouts are not uncommon. (Google mandates a maximum 30 second request time and your app can easily take up half of that in coming out of hibernation if it hasn't been accessed recently)
Right now I am building another RESTful app and chose to go the Spring 3 MVC / Hibernate / MYSQL route. I am not new to Spring DI or MySQL, but I am new to Spring MVC and it is taking me days to work through all the issues I am encountering. I am disappointed in the quality of available documentation and I have not been able to find a reasonable and complete Spring 3 MVC RESTful CRUD tutorial anywhere. Argh.
I don't have experience with Restlet but Spring MVC 3.0 is quite powerful for building restful webservice AND webapps. So if you also plan for your service to be accessible through browsers then it is a great solution since your controllers can serve both apps and browsers.
Perhaps this is also possible with Restlet but I have not heard of its capabilities for building webapps.
Just beware that Spring has a high loading time. This means that you have to be careful to avoid slow responses from cold starts.

Creating Java Web Service using Google AppEngine

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server.
I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards.
I would like to at least have some direction on how to create a web service using the Java technology AppEngine provides. I've searched but the articles are sparse and too lengthy while not providing any simple solutions.
I'd love it if I can create a web service using Java's annotations just like you can do in .NET with attributes.
I'd appreciate links to articles and guidance a full source answer is not required but would be appreciated.
No python based answers please.
IMO, there is no simple solution to build a Web Service on GAE with Java.
But, it's still achievable. Let's start with the Web Services we want to build.
In common usage the term refers to
clients and servers that communicate
over the Hypertext Transfer Protocol
(HTTP) protocol used on the web. Such
services tend to fall into one of two
camps: Big Web Services and
RESTful Web Services.
"Big Web Services" use SOAP/RPC format and RESTful Web Services use REST style one. You can read more about SOAP vs REST.
There are lots of Java open source Web Services frameworks out there. Most of them are generally based on the Java API for XML Web Services (JAX-WS), part of the Java EE platform.
JAX-WS is not supported by Google App Engine as specified in the list Will it play in App Engine. So forget about the "cool Java's annotations".
But, Restlet seems compatible with GAE. So if you think REST could be an option for you, I would go ahead and take a look at the Hello World tutorial of Restlet. Then, I'd go ahead and read the article on how to integrate Restlet with GAE.

Categories