Google App Engine Java and GWT Application Development

Google App Engine Java and GWT Application Development
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 20%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Comprehensive coverage of building scalable, modular, and maintainable applications with GWT and GAE using Java
  • Leverage the Google App Engine services and enhance your app functionality and performance
  • Integrate your application with Google Accounts, Facebook, and Twitter
  • Safely deploy, monitor, and maintain your GAE applications
  • A practical guide with a step-by-step approach that helps you build an application in stages

Book Details

Language : English
Paperback : 480 pages [ 235mm x 191mm ]
Release Date : November 2010
ISBN : 1849690448
ISBN 13 : 9781849690447
Author(s) : Daniel Guermeur, Amy Unruh
Topics and Technologies : All Books, Application Development, Google, AJAX, Java, Open Source

Table of Contents

Chapter 1: Introduction
Chapter 2: Using Eclipse and the Google Plugin
Chapter 3: Building the Connectr User Interface with GWT
Chapter 4: Persisting Data: The App Engine Datastore
Chapter 5: JDO Object Relationships and Queries
Chapter 6: Implementing MVP, an Event Bus, and Other GWT Patterns
Chapter 7: Background Processing and Feed Management
Chapter 8: Authentication using Twitter, Facebook OAuth, and Google Accounts
Chapter 9: Robustness and Scalability: Transactions, Memcache, and Datastore Design
Chapter 10: Pushing Fresh Content to Clients with the Channel API
Chapter 11: Managing and Backing Up your App Engine Application
Chapter 12: Asynchronous Processing with Cron, Task Queue, and XMPP
Chapter 13: Conclusion and Final Thoughts
  • Chapter 1: Introduction
    • Overview of the chapter
    • Introduction to Google App Engine
      • The Datastore
        • App Engine's scalable services
        • Java App Engine runtime and the application development environment
        • GAE/J and the Eclipse IDE
        • App Engine application hosting
        • App Engine "surprises" for new developers
      • Introduction to GWT
        • GWT UI support
        • Other GWT features
        • GWT's RPC API
        • GWT with GAE
        • The GWT/GAE Eclipse plugin
        • GWT support for Java
        • Recommended GWT background
    • Example application: Connectr
      • A look ahead
    • Online resources
      • GAE and GWT galleries
      • Documentation, blogs, and discussion groups
    • Summary
  • Chapter 2: Using Eclipse and the Google Plugin
    • Installing the plugin and supporting software
      • Installing the Java SDK
        • Installing Java on Mac OS X
        • Installing Java on other platforms
      • Installing Eclipse
      • Installing the Google plugin
        • Updating the Google plugin
    • Developing your application in Eclipse
      • Creating a new web application project in Eclipse
        • First look: The anatomy of a web application project
        • The Google plugin wizards and helpers
    • Running and debugging your application
      • Running your application in Development Mode
        • Developing the application in debug mode
        • Development Mode and the GWT browser plugin
        • Defining a run or debug configuration
      • Debugging
      • Compiling your GWT code for production mode
    • Deploying your application
      • Registering and setting an application ID for your application
      • How to set the application ID and version for a project
      • Uploading and deploying your application
      • Your App Engine Admin Console
    • Importing an existing application
      • Adding the Google SDKs to your project's build path
      • Adding third-party JAR files
      • Managing multiple Google SDKs
      • Running Google's demo apps in Eclipse
    • Summary
  • Chapter 3: Building the Connectr User Interface with GWT
    • Installing the (first version of) the Connectr project in Eclipse
    • AJAX and its benefits
    • Why AJAX apps are the way forward
      • AJAX apps minimize traffic and workload both on the client and the server
    • Challenges associated with AJAX programming and how GWT solves them
      • JavaScript browser's implementation is not consistent
      • Mastering JavaScript—an uphill battle
      • How GWT comes to the rescue to make developers more efficient
    • Google Web Toolkit overview—modern tools for modern developers
      • GWT user interface building blocks
    • Building the Connectr application—the user interface
      • User interface design elements of Connectr
      • Coding the Connectr user interface
      • Introducing UiBinder to increase productivity
        • Declarative UiBinder versus procedural Java—let's compare
      • Implementing the application layout with UiBinder
      • Tying the view to the Java code
      • Adding custom widgets to UiBinder
      • Adding CSS styles to the application
      • Implementing CSS styles in a global CSS file
      • Adding a logo to the application
      • Catching mouse and keyboard events
    • Grouping CSS files and images for faster speed with ClientBundle
      • Creating a ClientBundle
      • Using image resources in Connectr
      • Automatically checking CSS styles at compile time with CssResource
    • Getting data from the server using GWT RPC
      • Creating the login service
      • Implementing the server-side login service
      • Creating the asynchronous interface
      • Invoking the login service
      • Catching exceptions
    • Summary
  • Chapter 4: Persisting Data: The App Engine Datastore
    • Introduction
      • The Connectr server-side object model
    • The Datastore
      • Datastore entities and their properties
      • Entity keys
      • Datastore queries and indexes
        • Queries are supported by indexes
        • App Engine queries are fast
      • The Datastore versus a relational database
    • JDO
      • Setting up JDO
    • Creating Connectr's data models
      • The PersistenceManager and the PersistenceManagerFactory
      • Making data classes persistable
        • Class and field annotations
      • Persistable field types
        • Core value types
        • Collections and multi-valued properties
        • Datastore keys and JDO key fields
        • Defining keys and core value type fields for Friend and UserAccount
        • Referencing complex objects
        • Serializable objects and serialized fields
        • Embedded classes
      • Data class inheritance
      • Saving, updating, and deleting data objects
        • Persisting an object
        • Fetching a persisted object by its key
        • Deleting a persisted object
        • An object has an associated PersistenceManager
        • Fetch groups
      • Connectr example: creating and modifying UserAccount and Friend data objects
        • Creating new Friend objects
        • Deleting a Friend object
        • Fetching a list of Friend objects using the key list
      • Detached objects
      • Detached Data Access Objects and Data Transfer Objects
        • DTOs in the Connectr application
    • Inspecting the Datastore
      • The local development console
      • The App Engine Datastore
        • Browsing the App Engine Datastore
        • Viewing application data statistics
    • Resources
    • Summary
  • Chapter 5: JDO Object Relationships and Queries
    • Modeling relationships between objects
      • Owned relationships and entity groups
      • Uni-directional owned relationships
        • Supporting uni-directional owned relationships in Connectr
        • Dependent children
      • Bi-directional owned relationships
        • Bi-directional one-to-one relationship
        • Bi-directional one-to-many relationship
      • One-to-many Collection ordering
      • Unowned relationships
    • Finding objects—queries and indexes
      • Constructing JDOQL queries
        • Query examples
        • Query filter operators
        • Query filters on fields with multiple values
        • Query sort orders and ranges
      • Executing a query and getting the results
        • Query cursors
        • Unset and unindexed entity fields
      • Deleting by query
      • Batch fetches using a list of keys
      • Keys-only queries
      • Extents: fetching all objects of a particular kind
    • The App Engine Datastore index
      • Automatically-generated indexes
      • Custom indexes
      • Revisiting constraints on queries
        • Exploding indexes
      • Using the Admin Console Datastore index viewer and index vacuuming
      • Side-stepping query constraints
        • Pre-persist callbacks—normalizing Friend name information
    • Summary
  • Chapter 6: Implementing MVP, an Event Bus, and Other GWT Patterns
    • Introducing MVP – The need for design patterns in software
    • Introduction to MVP
      • The view
      • The model
      • The Presenter
    • Connectr MVP application architecture overview
      • Package and file organization
    • Coding MVP into Connectr
      • Starting up the application
      • Inside a presenter
        • Populating the Friend list view
        • Responding to user interface events
      • Listening to the event bus
      • Integrating UiBinder views into MVP
    • Events and the event bus
      • Creating a custom event class
      • Adding an application controller
    • Adding support for browser history
      • Introducing the browser history stack and navigation tokens
    • Implementing browser history management
      • Bootstrapping the browser history at application startup
    • Centralizing RPC calls for better handling and usability and reliability
      • Introducing an encompassing RPC class
      • Displaying a loading indicator when the app is busy
      • Catching server exceptions
      • Retrying a call after failure
      • Putting it all together
    • MVP Development with Activities and Places
      • Building a basic application
      • Traditional MVP versus MVP with Activities and Places
      • Moving parts of ProfileMVP
        • Activities
        • Places and the Place History Mapper
        • Views
      • The Browser Factory
        • Adding deferred binding for iPhone and Android views
      • Activity mapper
      • Putting the pieces together: the onModuleLoad method
    • Summary
  • Chapter 7: Background Processing and Feed Management
    • Overview of the chapter
    • Using Servlets in App Engine
      • Making your Servlets accessible—the deployment descriptor
      • Defining a Servlet
        • Servlet requests and responses
        • Generating a response
      • App Engine Servlet limitations
      • Restricting access to a Servlet
      • Sessions
      • The JRE whitelist and system restrictions
      • Accessing static application files
    • Using migrations to evolve the Datastore entities
      • Removing a field from a JDO data class definition
      • Adding a field to a JDO data class definition
      • Facilitating "schema" transitions via migrations
        • Approach—defining a migration
        • The Migration interface
        • Implementing a Migration: The FriendMigration class
      • Running the Migration: A Migration Servlet and the Task Queue
        • Invoking the Servlet as a web request
        • Servlet admin authentication
    • Pulling in Feeds: The URL Fetch service
      • App Engine services
      • URL Fetch
        • Java support for URL Fetch
      • Using
        • Making an HTTP request
        • Using HTTP(S) URLConnection objects
      • The "low-level" Java URL Fetch API
      • The ROME and ROME Fetcher RSS/Atom libraries
        • Downloading the ROME and ROME Fetcher jars and their dependencies
        • Installing the library JAR files
    • Using RSS/Atom feeds in the Connectr app
      • Adding feed support
      • The feed classes
        • Adding and removing friend feeds
      • Fetching and updating feeds
        • Subclassing the ROME Fetcher HttpURLFeedFetcher class
      • Processing changes to Friend URLs
    • Enabling background feed updating and processing
      • Add some test feeds to your app
      • Updating the most recently requested FeedInfo objects
        • The FeedUpdateServlet mapping
        • Using an admin-only Servlet URL for the feed update job
      • Updating all feeds for the Friends of a UserAccount
        • Updating the feeds for a specific Friend
      • A simple Servlet to display feed contents
    • Summary
  • Chapter 8: Authentication using Twitter, Facebook OAuth, and Google Accounts
    • Connectr login implementation
      • Step-by-step implementation of the login sequence
    • OAuth: a new way to login and authorize
    • Integrating with Facebook
    • Registering Connectr with Facebook
      • Authenticating with Facebook OAuth
      • Integrating Connectr inside Facebook
    • Authenticating against Google
    • Authenticating against Twitter with OAuth
      • Registering Connectr with Twitter
      • Introducing the Twitter login Servlet
      • Analyzing the Twitter callback Servlet
    • Logging out
      • Logging out when authenticating against Google or Twitter
      • Logging out of Facebook
    • Uniquely identifying Connectr users
    • Automatically registering users when they login
    • Summary
  • Chapter 9: Robustness and Scalability: Transactions, Memcache, and Datastore Design
    • Data modeling and scalability
      • Reducing latency—read consistency and Datastore access deadlines
      • Splitting big data models into multiple entities to make access more efficient
        • Discussion
      • Splitting a model by creating an "index" and a "data" entity
      • Use of property lists to support "join" behavior
        • Supporting the semantics of more complex joins
    • Using transactions
      • Transaction commits and rollbacks
        • Example—a JDO transaction
        • App Engine transactions use optimistic concurrency
        • Transaction retries
      • Transactions and entity groups
      • Creating entities in the same entity group
        • Getting the entity parent key from the child key
        • Entity group design considerations
      • What you can do inside a transaction
      • When to use a transaction
      • Adding transactional control to the Connectr application
        • Transactional tasks
    • Using Memcache
      • Using the App Engine Memcache Java API in Connectr
        • Memcache error handlers
        • Memcache statistics
        • Atomic increment/decrement of Memcache values
      • Using Memcache with JDO data objects
      • JDO lifecycle listeners
        • Defining a cacheable interface
        • The Connectr application's lifecycle listeners
    • Summary
  • Chapter 10: Pushing Fresh Content to Clients with the Channel API
    • Why use push technology
    • Implementation overview
    • Setting up the application to handle pushed messages
      • Server side channel creation
        • Under the hood of ChannelServer
      • Preparing the GWT client for pushed messages
        • Adding a handler to process pushed messages
    • Pushing messages to clients
    • Creating custom classes of pushed messages
    • Telling the server a client is inactive
    • Adding a refresh button to allow on-demand news updates
    • Summary
  • Chapter 11: Managing and Backing Up your App Engine Application
    • Configuration and deployment
      • Configuration
        • The deployment descriptor—web.xml
        • Configuring DoS protection blacklists—dos.xml
        • App configuration—appengine-web.xml
        • App engine application versions
        • Application file limits
    • The Admin Console
      • Browsing an app version's logs
        • App server startup latency
      • Quotas and billing
        • Monitoring your quota levels and resource usage
        • Application behavior when a quota is depleted
      • Adding developers for an application
    • Command-line administration
      • Using
        • Locating
        • Using
        • Downloading application logs
      • Bulk download and upload of an app's Datastore
        • Downloading data
        • Uploading or restoring data
    • Using Appstats
      • Enabling and configuring Appstats
      • Browsing the Appstats statistics page
    • Using your own domain for an app
    • Summary
  • Chapter 12: Asynchronous Processing with Cron, Task Queue, and XMPP
    • Introduction
      • What the client sees
      • What goes on behind the scenes
      • Overview of the chapter
    • Activity stream classes
      • The StreamItem persistent class
        • HTML 'sanitization'
      • The StreamItem DTOs
    • Server-Side asynchronous processing
      • Tasks and Task Queues
        • Task Queue specification
        • Task Queue quotas and limits
        • Monitoring tasks in the App Engine Admin Console
        • Using application-defined Task Queues
        • Defining a task: TaskOptions
        • Some Task Queue design considerations
      • Cron Jobs
      • Asynchronous server-side tasks in Connectr
        • Regular background tasks
        • Context-Specific feed update tasks
    • Supporting synchronous content delivery: Datastore queries and caching
      • Making StreamItem queries fast
        • Finding StreamItems for all Friends of a user: doing write-time work to make queries fast
        • Filtering the StreamItems on a subset of the user's Friends: Using key paths and contains()
      • Stream cache management
    • XMPP: Information push to the app
      • The App Engine XMPP service and API
        • XMPP addresses
        • Sending an XMPP message
        • Receiving an XMPP message
        • XMPP-related quotas and limits
      • Setting up Connectr as an XMPP client
        • Subscribing a Connectr app to the XMPP Breaking News Gateway App
        • Processing the incoming XMPP notifications
    • Summary

Daniel Guermeur

Daniel Guermeur is the founder and CEO of Metadot Corporation. Daniel holds a Diplome d'Ingenieur of Informatique from the University of Technology of Compiègne (France) as well as a Master in Photonics from the Ecole Nationale Supérieure de Physique of Strasbourg (France). Before starting Metadot in 2000, he worked for oil services companies including giant Schlumberger Ltd, where he helped improve the worldwide IT infrastructure. Daniel has been developing large-scale database-backed web applications since the very beginning of the democratization of the Internet in 1995, including: an open source software content management system, Metadot Portal Server; Mojo Helpdesk, a web-based customer support application; and Montastic, a popular website monitor service.

Amy Unruh

Amy Unruh currently does technical training and course development, with a focus on web technologies. Previously, she was a Research Fellow at the University of Melbourne, where she taught web technologies and researched building robust agent systems. Prior to that, she worked at several startups, served as adjunct faculty at the University of Texas, and was a member of the InfoSleuth Distributed Agents Program at MCC. She received her Ph.D. in CS/AI from Stanford University, in the area of AI planning, and has a BS degree in CS from UCSB. She has numerous publications, and has co-edited a book on Safety and Security in Multiagent Systems.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 4 submitted: last submission 27 Aug 2013

Errata type: Others | Page number: 115 | Errata date: 06 Sep 2011

this.setEmailAddress should be this.details.setEmailAddress


Errata type: Typos | Page number: 57 | Errata date: 09 Apr 2013

In the Figure:4, instead of "Not of lot of data(fast)", it should be "Not a lot of data(fast)"


Errata type: Graphics | Page number: 71 | Errata date: 09 Apr 2013

In the Figure:10, the mouse is pointed to the ClientBundle tab, instead, it should point to the UiBinder tab exactly below it.


Errata type: typo | Page Number: 179 | Errata Date: 27 Aug 2013

In the line: Let's dive into the MVP architecture and explains its different components the word "explains" should be replaced with "explain".

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Google App Engine Java and GWT Application Development +    Alfresco 3 Web Content Management =
50% Off
the second eBook
Price for both: $45.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Develop state-of-the-art AJAX web applications with optimized JavaScript using GAE and GWT
  • Explore the basics of using Eclipse via a sample GWT/Google App Engine application generated automatically by the Google plugin
  • Learn how GWT works as an AJAX framework, and why it makes you more productive as a developer
  • Use GWT RPC for easy client-server communication
  • Develop a GWT + App Engine application locally and use Eclipse for "one-click" deployment
  • Construct GWT user-interface elements using UIBinder, so that layout and style information is separated from logic
  • Integrate your application with Google Accounts, Facebook, and Twitter for user authentication and information retrieval
  • Delve deeper, to investigate datastore-related ways to help increase the robustness, speed, and scalability of an App Engine app, and apply these techniques to our "Connectr" application
  • Configure, deploy, monitor, and maintain an App Engine application


In Detail

Google Application Engine is a cloud computing technology that lets you run web applications that are easy to build and maintain as well as being scaled and load-balanced automatically. To build interesting and interactive web applications developers are turning to Java. However, building and deploying scalable web applications using Google Web Toolkit and Google App Engine for Java can be challenging even to developers. The start to finish approach of this book helps you meet these challenges.

This book is designed to give developers all the information they need to develop their own GAE+GWT applications, with a particular focus on some of the technologies useful for building scalable social-media-oriented applications. It is an easy-to-follow guide that shows you how to get the most out of combining the powerful features of GAE and GWT. It provides you with solutions to many of the problems that arise in developing, maintaining, and scaling web applications.

The book introduces you to the features of Google App Engine (GAE) and the Google Web Toolkit (GWT) to help you build interesting and interactive real-world AJAX applications. Over the course of the book, you are guided by the development of a sample application using the Google Web Toolkit (GWT) plugin for Eclipse. To make things easier for you, all application building blocks are explained in detail, walking you through the development process step by step.

The book teaches you the key technologies and methodologies that can be applied to developing your application locally, enhancing your application functionality and accelerating performance, integrating your application with Google Accounts, Facebook, and Twitter as well as monitoring and maintaining your web application.

Packed with great examples and clear explanations, you will be able to build your own web applications that are scalable and reliable using GAE and GWT with Java.

Build a real-world interactive web application in the cloud using GAE/J and GWT, with Push, background processing, OAuth, social media APIs, and more


This is a practical guide with a step-by-step approach that builds an application in stages. Each stage of the application is used along with screenshots to introduce or develop your understanding of how to write powerful GAE applications.

Who this book is for

If you are a developer with prior programming experience of Java development and object-oriented programming and want to understand the key concepts of how to build AJAX web applications with Java, then this book is for you. The book assumes some previous exposure to the basics of using GWT, for example at the level of Google's online introductory GWT tutorials. You don't need to know anything about Google App Engine. This book will teach you everything you need.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software