Wet Feet – Online Marketing and Technology Blog

  But I can only show you the door. You're the one that has to walk through it. (Morpheus)

 
Google App Engine + JAVA + JDO + Inheritance + One-To-Many Relationships
Written by Tomas, January 13th, 2010   

Objective

This article will show you how to persist real world data in Google App Engine. You will learn how to handle inheritance and one-to-many owned relationships in your model objects and store them correctly in the big table implementation of JDO.

The Problem Domain

In my application I need to segregate data by the customer this data belongs to. We will use inheritance in model objects, so all of them will have customer id defined in the base class. We will make the JDO save base class properties in the sub class “table”. We will also learn how to instruct Google App Engine JDO to handle customers with multiple addresses and phone numbers for us. If we define the relationship between model objects correctly JDO will manage storing/retrieving/deleting of these lined objects without our involvement.

Read the rest of this entry »


Read more...
 
Google App Engine + JAVA + Spring + REST + Mapping Exceptions to Errors for JSON
Written by Tomas, December 16th, 2009   

error_screenshot

Objective

We are talking REST+JSON from browser to the server and back, so we need to report errors nicely. Exception thrown on the server have to be converted to error messages and transmitted to the client in JSON format. Luckily there is a very elegant solution for this in Spring.

HandlerExceptionResolver interface

Spring provides a very handy HandlerExceptionResolver interface for mapping exceptions to views. If you check the documentation (and you should) you will notice that where are couple exception handlers already implemented, but we will create our own. Just because we can.

Read the rest of this entry »


Read more...
 
Goolge app engine + java + spring + REST + JSON + Flex – Part 3
Written by Tomas, November 18th, 2009   

the_lock

Objective

After reading this post you will be able to implement robust user authentication and authorization scheme without replicating code to check if user is logged in and if the are authorized to perform a certain action.

The Problem Domain

You, like me, face the same problem with each web application – user authentication and authorization. Who is logged in? Can they delete this entity? Can they see this report? How to solve this problem without copy pasting same piece of code to every servlet/action/controller/whatever? If you are using spring MVC there is a very elegant and powerful solution – Interceptors.

You can have as many interceptors as you like, I usually have one for security and maybe one more for some other task. Interceptor fires before your controller/action gets invoked. If it returns true the flow can continue, if it returns false the execution stops right there – request has been handled by the interceptor.
Read the rest of this entry »


Read more...
 
Goolge app engine + java + spring + REST + JSON + Flex – Part 2
Written by Tomas, October 29th, 2009   

www_1

Objective

Once you are finished with this article, you will be able to store application data in Google App Engine Data store and consume REST service using flex client.

Common Problems and Solutions

In my personal opinion flash player security model is the biggest piece of bullshit I ever encountered. If you sit down and thing just for 10 seconds about how it is implemented you will have to agree that it provides NO security at all. It just makes impossible so do certain things, that’s all. Adobe needs to drop it now.

Here is the problem that we have with REST and Google app engine: Adobe’s implementation of HTTPService only supports GET and POST, to consume REST we need at least 3 methods: GET, POST and DELETE. We can live without PUT – if id is null JDO will create a new persisted object, if it is set JDO will update it. But we still do not have support for DELETE. Read the rest of this entry »


Read more...
 
Goolge app engine + java + spring + REST + JSON + Flex – Part 1
Written by Tomas, October 26th, 2009   

Objective

Once you are finished with this article, you will be able to implement REST services in Google Apps Engine using JAVA, Spring 3.0 and JSON. In the next part you will learn how to add flex application to consume the services.

Step one – Getting all required libraries: Google App Engine SDK, Spring and JSON serializer

If you are using Eclipse (my favorite IDE), you can install google plugin from here. If you choose to go another route, you need to download the sdk, create the project and join us back in the next section. Once you install the plugin, restart eclipse and you can see these buttons

Google App Engine Project Button

you can proceed to the next section.

Step Two – Create new project

Go to new project wizzard Read the rest of this entry »


Read more...
 
« Older Entries