REST in Google App Engine using Java

developer series heading

One of the key skills of Rococo Global Technologies Corporation ( RGTC ) is our advocacy in developing quality cloud applications using Google App Engine with Java. For more information on our skills, visit this link. Along with application development is the use of Representational State Transfer (REST) protocol. In this developer blog series, let’s take a look at these concepts, and kick start your development for REST in Google App Engine using Java.

Representational State Transfer (REST) Protocol

Defined by Wikipedia as:

In computing, representational state transfer (REST) is an architectural style consisting of a coordinated set of components, connectors, and data elements within a distributed hypermedia system, where the focus is on component roles and a specific set of interactions between data elements rather than implementation details. Its purpose is to induce performance, scalability, simplicity, modifiability, visibility, portability, and reliability. REST is the software architectural style of the World Wide Web.

REST simplified the communication of data within the internet, as compared to its predecessor, Simple Object Access Protocol (SOAP). While both protocols have their own pros and cons, REST is widely adopted in both web and mobile applications because of its simplicity and performance. To point out the simplicity of REST, it uses the default Hyper Text Transfer Protocol (HTTP) and attaches necessary data, that’s it. No special servers needed, and no special configuration for servers, as long as the server can understand HTTP requests.

Along with the use of REST, developers recommend the use of Javascript Object Notation (JSON) structure. Due to JSON’s simplistic and lightweight data design, it is the perfect fit for REST. Any developer who has experience in web development should have no problem in using JSON structure.

Using both REST and JSON all together will be in the next section.



As mentioned in the previous section, REST uses HTTP to send out messages to the server.
First, HTTP request method tells the server what operation to do.

Request Method Types

  • GET – Retrieves certain information from the server.
  • POST – Send data to the server for adding and/or inserting data.
  • PUT – Send data to the server to update specific data.
  • DELETE – Deletes certain data in the server.

Next, the HTTP request should have data attached to either its request body in JSON format. On the other hand, other data may be placed in the request parameter in URL-friendly format.

Request Body in JSON

{ data : [ forSomeKey : withValue ] }

The server then translates the request and returns the corresponding response status codes based on HTTP/1.1 specifications.

Response Status

  • 2xx – When the operation exit correctly.
  • 3xx – When the resource requested is not here.
  • 4xx – Some error encountered when processing the request.
  • 5xx – When server crashed or needs fixing. Need to contact an administrator.

Finally, data may be attached to the response similar to the request for further processing.


Google app engine (GAE)

App Engine Logo
Google App Engine (Latest Version)
App Engine Logo Old
App Engine Logo (First Version)






Google App Engine (GAE) is Google’s answer to the growing industry for cloud computing platform. This platform allows developers to write codes in either Go, Java, Python and PHP. Few of the advantages of GAE include

  • Pay only for the resources used. Fine-graded payment calculation for resources used.
  • Light admin load. GAE requires minimal supervision. Upload the app and it’s good to go.
  • Quick app update. Upload the app and GAE will do the rest to switch version.
  • Seamless integration with Google Services. As a result, email sending just works without additional configuration.
  • Intelligent distribution of network load. While the server experiences heavy usage, GAE duplicates the application to cater incoming requests.

In addition, to provide users with fast responses, GAE only allows the applications to return a response with 60 seconds or 1 minute. Otherwise, it terminates the request abruptly. To achieve this, GAE offers a modular architecture and components to split tasks across the server without affecting the end users.

Components that helps speed up applications are:

  • Task Queues
  • Scheduled Tasks
  • Memcache

Furthermore, details of these components and modular design are on their developer site.



app engine + java

While GAE does not support all classes in the Java runtime library as stated in this link, most libraries of common web application applications are supported. As a result, a majority of the web frameworks that supports REST in Java will run on GAE. Moreover, this allows developers to create applications using REST in Google App Engine.

Below are few of the usual frameworks that would work on GAE as of writing this blog that supports REST.

Slim3 is an MVC framework fully optimized to work with Google App Engine with Java and Google’s Datastore. This framework leverages the spin-up architecture of the App Engine. Despite the rapid updates of App Engine, there seem to be not many updates since version 1.16.

Getting Started:

Jersey is based on the JAX-RS specifications to develop RESTful services. It is part of the Glassfish project by Oracle created in-house in pure Java form. As a result, Jersey stands as the standard open source framework for REST applications.

Getting Started:

Spring Boot makes it easy to create Spring-powered, production-grade applications and services with absolute minimum fuss.
– Taken from the Spring boot site

Also, Spring is usually the de-facto standard for enterprise-level applications because of its flexibility, and supporting projects that help the lives of the developers in different components of an application. The problem with spring is its boot-up time take a really long time, especially many spring components are used for the application.

Getting Started:
  • And others…

There are a lot of frameworks available that may work with App Engine given the servers rules and constraints. Therefore feel free to try other frameworks and hit us back in the comments below for other recommended frameworks.


Final Thoughts

In conclusion, given the performance that REST protocol ensures along with JSON data, GAE with Java matches this by providing small modular instances. As a result, this enables us to receive the fastest response time as possible, alongside with the application with an optimised boot-up sequence. Hence the design of the application’s framework and structure plays a major key to delivering the fast and reliable application to the end users.


Leave a Reply

Your email address will not be published.