Book Image

Google App Engine Java and GWT Application Development

By : Daniel Guermeur, Amy Unruh
Book Image

Google App Engine Java and GWT Application Development

By: Daniel Guermeur, Amy Unruh

Overview of this book

<p>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.<br /><br />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.<br /><br />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.<br /><br />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.</p> <p>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.</p>
Table of Contents (19 chapters)
Google App Engine Java and GWT Application Development
Credits
About the Authors
About the Reviewers
Preface
Index

Authenticating against Twitter with OAuth


Twitter authentication implementation is structured the same way as Facebook's and Google's. We first initiate a redirect to Twitter where users authenticate and grant access to Connectr. Then Twitter redirects them back to a callback URL where the login sequence is completed.

Instead of coding the OAuth authentication fully in Java without using a third party library, like we did for Facebook authentication, we use a library called twitter4j. This library provides easy access to the Twitter OAuth API, which we use to authenticate and get the current user's information. More information about this library can be found at http://twitter4j.org.

Registering Connectr with Twitter

The first step is to register Connectr with Twitter at http://twitter.com/apps/new:

Figure10: Register an application with Twitter

Once created, Twitter provides us with both OAuth consumer and secret keys as shown in the following image:

Figure11: Connectr application details

We save...