SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
Google App Engine
tutorial

1

Google App Engine tutorial - 2013
Table of contents
• Open an account
• Installing GAE plugin for eclipse
• Installing JRE and JDK
• Register & Login example
• GAE Junit
• More features of GAE
• Example source code
Note: As for now, it is possible to write your server side code in Python, Java
or PHP. This slideshow demonstrates an example using Java.

2

Google App Engine tutorial - 2013
Open an account
Suppose we have a Gmail account: nameforthetutorial@gmail.com.
Go to the address: https://developers.google.com/appengine/ and click Sign Up.

3

Google App Engine tutorial - 2013
Open an account
Fill in the project name.
The Project ID is your unique server name.
You can use the one that was generate for you or set one as you like as long
as no one else is already using it.
Your server address will be http://<your_project_id>.appspot.com.
Click Get Started.

4

Google App Engine tutorial - 2013
Open an account
In the next window click your project name.

5

Google App Engine tutorial - 2013
Open an account
Here you can view all of your projects.
You can open up to 10 projects per Gmail account.
Click your project name.

6

Google App Engine tutorial - 2013
Open an account
Now click App Engine.

7

Google App Engine tutorial - 2013
Open an account
You made it. That’s your main dashboard.
Here you manage your app.

8

Google App Engine tutorial - 2013
Installing GAE plugin for eclipse
Depends on your eclipse version, follow the instructions in the relevant link:
https://developers.google.com/eclipse/docs/install-eclipse-4.3
https://developers.google.com/eclipse/docs/install-eclipse-4.2
https://developers.google.com/eclipse/docs/install-eclipse-3.7
When finished you’ll see a blue Google symbol (
Now sign in to your account:
In the lower right corner click Sign in to Google:

9

Google App Engine tutorial - 2013

) in your upper toolbar.
Installing JRE and JDK
You may have problems with your JDK or JRE, so download the latest versions
from the java site:
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads1880261.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads1880260.html

10

Google App Engine tutorial - 2013
Register & Login example
A simple example only to understand how to communicate between your
Android app and your GAE server.
We will use POST request.
Usually Get request is for getting back data from the sever, while POST request
is for storing data in the server.
In Get request the parameters are passed in the url, while in POST request a
package is being sent to the server with the parameters encoded inside.
The following example uses POST request both for getting back data from the
server and for storing data in the server. The reason is that in order to get back
the data from the server, our password is being sent on the web and we don’t
want it to appear in the url.
Note: Using POST request is not a sufficient protection for sending password on
the web. An SSL protection is needed as will be shown next.

11

Google App Engine tutorial - 2013
Register & Login example – Server side
Click the Google symbol (
Project…

12

) in your eclipse. Then choose New Web Application

Google App Engine tutorial - 2013
Register & Login example – Server side
Fill in your server side app name and also a
package name.
Click Finish.

13

Google App Engine tutorial - 2013
Register & Login example – Server side
Your server side project should look like in the image.
Predictable problems:
- If you are missing the App Engine SDK or the JRE
System Library then:
Right click your project name > properties > Java Build
Path > choose Libraries tab > in the menu on the right
choose Add Library… > choose Google App Engine >
Next > Finish.
In the same way for the JRE but instead of choosing
Google App Engine choose JRE System Library.
- If the warWEB-INFlib is empty then try:
Right click your project name > properties > expand Google > App Engine > uncheck
Use Google App Engine box > OK.
Then do it again but now check the Use Google App Engine box and your libraries
should be added.
Note: In general Project > Clean do magic.
14

Google App Engine tutorial - 2013
Register & Login example – Server side
Now Go to appengineweb.xml and set your
project id.
That’s the connection
between your code and
the Google App Engine
project you opened
earlier.

15

Google App Engine tutorial - 2013
Register & Login example – Server side

Create two classes: Register & Login.
We need them in order to define two servlets:
https://clean-abacus-384.appspot.com/login
https://clean-abacus-384.appspot.com/register

16

Google App Engine tutorial - 2013
Register & Login example – Server side
Define the two classes we’ve just created as
servlets, and map them to the corresponding urls.
For example, according to the written on the right
the url
https://clean-abacus-384.appspot.com/login
is mapped to the servlet Login which is referred to
the com.serversideexample.Login class, which we
defined in the previous slide.

In lines 34-42 you can see the definition of the
security constraint for using SSL.
For further reading about applying SSL protection
in GAE:
https://developers.google.com/appengine/docs/ja
va/config/webxml#Secure_URLs

17

Google App Engine tutorial - 2013
Register & Login example – Server side
Register class extends
HttpServlet in order to
define the Register
servlet.
The datastore may
contain many kinds of
entities all together in
the same table (there
is only one table). Here
we create a Person
kind entity by
specifying it in the
entity’s constructor.

18

Google App Engine tutorial - 2013
Register & Login example – Server side
As before Login class
extends HttpServlet in
order to define the Login
servlet.
We should specify which
entity we’re looking for (line
47).
Note: in CompositeFilter
also “or” operator may be
used.
In FilterOperator also “gt”,
”gte”, ”lt”, ”lte”, ”ne”, ”in”
may be used.

19

Google App Engine tutorial - 2013
Register & Login example – Server side
Deploy your project:
Right click your project name > Google > Deploy to App Engine and then click Deploy.

20

Google App Engine tutorial - 2013
Register & Login example – Client side
Suppose you have a little experience in Android.
Create a new app with the following permissions:

Now set main_activity.xml to look like that:

21

Google App Engine tutorial - 2013
Register & Login example – Client side
A simple activity which
listens the two buttons
and calls the execute
function in the
ClientAsync class in order
to perform the POST
request to the GAE server.

22

Google App Engine tutorial - 2013
Register & Login example – Client side
ClientAsync extends
AsyncTask in order to work in
background, sets a POST
request with the encoded
parameters which the server
is expecting for.
ClientAsync uses
HttpsURLConnection for
supporting GAE’s SSL security
constraint.
Finally displays the server’s
answer with the TextView
object.

23

Google App Engine tutorial - 2013
Register & Login example – Testing
Starting point:
Datastore is empty. Fill in some details and click Register.

24

Google App Engine tutorial - 2013
Register & Login example – Testing
After clicking Register the Person will be shown in the datastore.
Note: The App engine gives every entity an unique id (key).
For further reading about keys:
https://developers.google.com/appengine/docs/java/datastore/entities#Java_Genera
ting_keys

25

Google App Engine tutorial - 2013
Register & Login example – Testing
Further Login Testing:

26

Google App Engine tutorial - 2013
GAE Junit
Test your code in a convenient way.
Setting up the framework:
• Right click your project name > properties > Java Build Path > choose Libraries tab > in
the menu on the right choose Add External Jars… > go to
eclipsepluginscom.google.appengine.eclipse.sdkbundle_1.8.6appengine-java-sdk1.8.6libimpl and select appengine-api.jar, appengine-api-labs.jar, appengine-apistubs.jar > Open > OK.

• Right click your project name > properties > Java Build Path > choose Libraries tab > in
the menu on the right choose Add External Jars… > go to
eclipsepluginscom.google.appengine.eclipse.sdkbundle_1.8.6appengine-java-sdk1.8.6libtesting and select appengine-testing.jar > Open > OK.
• Right click your project name > properties > Java Build Path > choose Libraries tab > in
the menu on the right choose Add Library… > choose Juint > Next > choose Junit 4 >
Finish.
For further reading about Junit:
https://developers.google.com/appengine/docs/java/tools/localunittesting
27

Google App Engine tutorial - 2013
GAE Junit
Junit:
To run the tests
do Run > Run
As… > Junit Test
Note: The
changes are local
and have no
effect on your
GAE datastore.

28

Google App Engine tutorial - 2013
More features of GAE
Jackson/Gson:
An easy way to transfer objects threw the web. User class should be at the server side and
at the client side. In the server side we convert user to json string into the response and in
the client side we read the json string and convert it back to user.
Server side:

Client side:

For further reading about Jackson:
http://wiki.fasterxml.com/JacksonInFiveMinutes
http://wiki.fasterxml.com/JacksonDownload
For further reading about Gson:
https://code.google.com/p/google-gson/
29

Google App Engine tutorial - 2013
More features of GAE

Objectify/JDO/JPA:
It’s possible to define an entity as a class.
More comfortable, less dirty code.

For further reading about Objectify:
https://code.google.com/p/objectify-appengine/
For further reading about JDO:
https://developers.google.com/appengine/docs/java/datastore/jdo/overview-dn2
For further reading about JPA:
https://developers.google.com/appengine/docs/java/datastore/jpa/overview
30

Google App Engine tutorial - 2013
More features of GAE
Sending mail from
your server:
You can send and
receive emails on
behalf of your project
ID.
Great for password
recovery, confirm
registration etc.

For further reading about mailing options:
https://developers.google.com/appengine/docs/java/mail/

31

Google App Engine tutorial - 2013
More features of GAE
Logging messages to Logs
console:
You can log out notes of
some categories: severe,
warning and info.
You can view your logs in
the Logs section in your
app’s console.
Great for debugging 

…

…

For further reading about logging:
https://developers.google.com/appengine/docs/java/#Java_Logging

32

Google App Engine tutorial - 2013
More features of GAE
Running on local host:
You can run your app locally. Do Run As > Web Application. Your server’s url now is
http://localhost:8888/.
You can get to your app’s console in: http://localhost:8888/_ah/admin.
Note: you may need to remove your SSL protection (use http://...) when testing locally.

33

Google App Engine tutorial - 2013
More features of GAE
More relevant topics:
• Transactions: atomic operations in the datastore. Obligatory for concurrent writes to
datastore.
https://developers.google.com/appengine/docs/java/datastore/transactions
• ThreadSafe: allowing your server to run your server side in parallel.
https://developers.google.com/appengine/docs/java/config/appconfig#Java_appengine_w
eb_xml_Using_concurrent_requests
• Backends: background services for heavy computations.
https://developers.google.com/appengine/docs/java/backends/
•Blobstore: storing large files like images, videos etc.
https://developers.google.com/appengine/docs/java/blobstore/
• Quotas: limits for free datastore usage.
https://developers.google.com/appengine/docs/quotas#Datastore
34

Google App Engine tutorial - 2013
Example source code
https://drive.google.com/folderview?id=0B0ZJh5uX_P5iLXNQdXVZc2stSDQ&usp=sharing

Daniel Abitbul – abitbul6@gmail.com
Omer Shpigelman – omer.shpigelman@gmail.com

35

Google App Engine tutorial - 2013

Contenu connexe

Tendances

I've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveI've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveSimon Willison
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Introrobinb123
 
What is Google App Engine
What is Google App EngineWhat is Google App Engine
What is Google App EngineChris Schalk
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest FeaturesChris Schalk
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Naga Rohit
 
Google app engine - Overview
Google app engine - OverviewGoogle app engine - Overview
Google app engine - OverviewNathan Quach
 
Google App Engine
Google App EngineGoogle App Engine
Google App EngineCsaba Toth
 
Google app engine
Google app engineGoogle app engine
Google app engineSuraj Mehta
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
Google app engine introduction
Google app engine introductionGoogle app engine introduction
Google app engine introductionrajsandhu1989
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with PythonBrian Lyttle
 
Google App Engine (Introduction)
Google App Engine (Introduction)Google App Engine (Introduction)
Google App Engine (Introduction)Praveen Hanchinal
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App EngineColin Su
 
App Engine Overview @ Google Hackathon SXSW 2010
App Engine Overview @ Google Hackathon SXSW 2010App Engine Overview @ Google Hackathon SXSW 2010
App Engine Overview @ Google Hackathon SXSW 2010Chris Schalk
 

Tendances (20)

I've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you haveI've (probably) been using Google App Engine for a week longer than you have
I've (probably) been using Google App Engine for a week longer than you have
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Gentle App Engine Intro
Gentle App Engine IntroGentle App Engine Intro
Gentle App Engine Intro
 
What is Google App Engine
What is Google App EngineWhat is Google App Engine
What is Google App Engine
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest Features
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
 
Google app engine - Overview
Google app engine - OverviewGoogle app engine - Overview
Google app engine - Overview
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Google app engine introduction
Google app engine introductionGoogle app engine introduction
Google app engine introduction
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
Google App Engine (Introduction)
Google App Engine (Introduction)Google App Engine (Introduction)
Google App Engine (Introduction)
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
App Engine Overview @ Google Hackathon SXSW 2010
App Engine Overview @ Google Hackathon SXSW 2010App Engine Overview @ Google Hackathon SXSW 2010
App Engine Overview @ Google Hackathon SXSW 2010
 
Google App engine
Google App engineGoogle App engine
Google App engine
 

Similaire à Google App Engine tutorial

Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schkannikadg
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingSarah Elson
 
Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAELove Sharma
 
Proper Connections Development for Proper Domino Developers
Proper Connections Development for Proper Domino DevelopersProper Connections Development for Proper Domino Developers
Proper Connections Development for Proper Domino DevelopersMark Myers
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial IntroPamela Fox
 
Udi Google Dev Day
Udi Google Dev DayUdi Google Dev Day
Udi Google Dev DayUdi Bauman
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Gil Irizarry
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressHristo Chakarov
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PAThomas Daly
 

Similaire à Google App Engine tutorial (20)

Google app engine
Google app engineGoogle app engine
Google app engine
 
Installing the java sdk
Installing the java sdkInstalling the java sdk
Installing the java sdk
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
Appium testing api
Appium testing apiAppium testing api
Appium testing api
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 sch
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAE
 
Proper Connections Development for Proper Domino Developers
Proper Connections Development for Proper Domino DevelopersProper Connections Development for Proper Domino Developers
Proper Connections Development for Proper Domino Developers
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
 
Udi Google Dev Day
Udi Google Dev DayUdi Google Dev Day
Udi Google Dev Day
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Creating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPressCreating Extensible Plugins for WordPress
Creating Extensible Plugins for WordPress
 
YouTube APIs Workshop
YouTube APIs WorkshopYouTube APIs Workshop
YouTube APIs Workshop
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
 
Gwt portlet
Gwt portletGwt portlet
Gwt portlet
 

Dernier

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Dernier (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Google App Engine tutorial

  • 1. Google App Engine tutorial 1 Google App Engine tutorial - 2013
  • 2. Table of contents • Open an account • Installing GAE plugin for eclipse • Installing JRE and JDK • Register & Login example • GAE Junit • More features of GAE • Example source code Note: As for now, it is possible to write your server side code in Python, Java or PHP. This slideshow demonstrates an example using Java. 2 Google App Engine tutorial - 2013
  • 3. Open an account Suppose we have a Gmail account: nameforthetutorial@gmail.com. Go to the address: https://developers.google.com/appengine/ and click Sign Up. 3 Google App Engine tutorial - 2013
  • 4. Open an account Fill in the project name. The Project ID is your unique server name. You can use the one that was generate for you or set one as you like as long as no one else is already using it. Your server address will be http://<your_project_id>.appspot.com. Click Get Started. 4 Google App Engine tutorial - 2013
  • 5. Open an account In the next window click your project name. 5 Google App Engine tutorial - 2013
  • 6. Open an account Here you can view all of your projects. You can open up to 10 projects per Gmail account. Click your project name. 6 Google App Engine tutorial - 2013
  • 7. Open an account Now click App Engine. 7 Google App Engine tutorial - 2013
  • 8. Open an account You made it. That’s your main dashboard. Here you manage your app. 8 Google App Engine tutorial - 2013
  • 9. Installing GAE plugin for eclipse Depends on your eclipse version, follow the instructions in the relevant link: https://developers.google.com/eclipse/docs/install-eclipse-4.3 https://developers.google.com/eclipse/docs/install-eclipse-4.2 https://developers.google.com/eclipse/docs/install-eclipse-3.7 When finished you’ll see a blue Google symbol ( Now sign in to your account: In the lower right corner click Sign in to Google: 9 Google App Engine tutorial - 2013 ) in your upper toolbar.
  • 10. Installing JRE and JDK You may have problems with your JDK or JRE, so download the latest versions from the java site: http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads1880261.html http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads1880260.html 10 Google App Engine tutorial - 2013
  • 11. Register & Login example A simple example only to understand how to communicate between your Android app and your GAE server. We will use POST request. Usually Get request is for getting back data from the sever, while POST request is for storing data in the server. In Get request the parameters are passed in the url, while in POST request a package is being sent to the server with the parameters encoded inside. The following example uses POST request both for getting back data from the server and for storing data in the server. The reason is that in order to get back the data from the server, our password is being sent on the web and we don’t want it to appear in the url. Note: Using POST request is not a sufficient protection for sending password on the web. An SSL protection is needed as will be shown next. 11 Google App Engine tutorial - 2013
  • 12. Register & Login example – Server side Click the Google symbol ( Project… 12 ) in your eclipse. Then choose New Web Application Google App Engine tutorial - 2013
  • 13. Register & Login example – Server side Fill in your server side app name and also a package name. Click Finish. 13 Google App Engine tutorial - 2013
  • 14. Register & Login example – Server side Your server side project should look like in the image. Predictable problems: - If you are missing the App Engine SDK or the JRE System Library then: Right click your project name > properties > Java Build Path > choose Libraries tab > in the menu on the right choose Add Library… > choose Google App Engine > Next > Finish. In the same way for the JRE but instead of choosing Google App Engine choose JRE System Library. - If the warWEB-INFlib is empty then try: Right click your project name > properties > expand Google > App Engine > uncheck Use Google App Engine box > OK. Then do it again but now check the Use Google App Engine box and your libraries should be added. Note: In general Project > Clean do magic. 14 Google App Engine tutorial - 2013
  • 15. Register & Login example – Server side Now Go to appengineweb.xml and set your project id. That’s the connection between your code and the Google App Engine project you opened earlier. 15 Google App Engine tutorial - 2013
  • 16. Register & Login example – Server side Create two classes: Register & Login. We need them in order to define two servlets: https://clean-abacus-384.appspot.com/login https://clean-abacus-384.appspot.com/register 16 Google App Engine tutorial - 2013
  • 17. Register & Login example – Server side Define the two classes we’ve just created as servlets, and map them to the corresponding urls. For example, according to the written on the right the url https://clean-abacus-384.appspot.com/login is mapped to the servlet Login which is referred to the com.serversideexample.Login class, which we defined in the previous slide. In lines 34-42 you can see the definition of the security constraint for using SSL. For further reading about applying SSL protection in GAE: https://developers.google.com/appengine/docs/ja va/config/webxml#Secure_URLs 17 Google App Engine tutorial - 2013
  • 18. Register & Login example – Server side Register class extends HttpServlet in order to define the Register servlet. The datastore may contain many kinds of entities all together in the same table (there is only one table). Here we create a Person kind entity by specifying it in the entity’s constructor. 18 Google App Engine tutorial - 2013
  • 19. Register & Login example – Server side As before Login class extends HttpServlet in order to define the Login servlet. We should specify which entity we’re looking for (line 47). Note: in CompositeFilter also “or” operator may be used. In FilterOperator also “gt”, ”gte”, ”lt”, ”lte”, ”ne”, ”in” may be used. 19 Google App Engine tutorial - 2013
  • 20. Register & Login example – Server side Deploy your project: Right click your project name > Google > Deploy to App Engine and then click Deploy. 20 Google App Engine tutorial - 2013
  • 21. Register & Login example – Client side Suppose you have a little experience in Android. Create a new app with the following permissions: Now set main_activity.xml to look like that: 21 Google App Engine tutorial - 2013
  • 22. Register & Login example – Client side A simple activity which listens the two buttons and calls the execute function in the ClientAsync class in order to perform the POST request to the GAE server. 22 Google App Engine tutorial - 2013
  • 23. Register & Login example – Client side ClientAsync extends AsyncTask in order to work in background, sets a POST request with the encoded parameters which the server is expecting for. ClientAsync uses HttpsURLConnection for supporting GAE’s SSL security constraint. Finally displays the server’s answer with the TextView object. 23 Google App Engine tutorial - 2013
  • 24. Register & Login example – Testing Starting point: Datastore is empty. Fill in some details and click Register. 24 Google App Engine tutorial - 2013
  • 25. Register & Login example – Testing After clicking Register the Person will be shown in the datastore. Note: The App engine gives every entity an unique id (key). For further reading about keys: https://developers.google.com/appengine/docs/java/datastore/entities#Java_Genera ting_keys 25 Google App Engine tutorial - 2013
  • 26. Register & Login example – Testing Further Login Testing: 26 Google App Engine tutorial - 2013
  • 27. GAE Junit Test your code in a convenient way. Setting up the framework: • Right click your project name > properties > Java Build Path > choose Libraries tab > in the menu on the right choose Add External Jars… > go to eclipsepluginscom.google.appengine.eclipse.sdkbundle_1.8.6appengine-java-sdk1.8.6libimpl and select appengine-api.jar, appengine-api-labs.jar, appengine-apistubs.jar > Open > OK. • Right click your project name > properties > Java Build Path > choose Libraries tab > in the menu on the right choose Add External Jars… > go to eclipsepluginscom.google.appengine.eclipse.sdkbundle_1.8.6appengine-java-sdk1.8.6libtesting and select appengine-testing.jar > Open > OK. • Right click your project name > properties > Java Build Path > choose Libraries tab > in the menu on the right choose Add Library… > choose Juint > Next > choose Junit 4 > Finish. For further reading about Junit: https://developers.google.com/appengine/docs/java/tools/localunittesting 27 Google App Engine tutorial - 2013
  • 28. GAE Junit Junit: To run the tests do Run > Run As… > Junit Test Note: The changes are local and have no effect on your GAE datastore. 28 Google App Engine tutorial - 2013
  • 29. More features of GAE Jackson/Gson: An easy way to transfer objects threw the web. User class should be at the server side and at the client side. In the server side we convert user to json string into the response and in the client side we read the json string and convert it back to user. Server side: Client side: For further reading about Jackson: http://wiki.fasterxml.com/JacksonInFiveMinutes http://wiki.fasterxml.com/JacksonDownload For further reading about Gson: https://code.google.com/p/google-gson/ 29 Google App Engine tutorial - 2013
  • 30. More features of GAE Objectify/JDO/JPA: It’s possible to define an entity as a class. More comfortable, less dirty code. For further reading about Objectify: https://code.google.com/p/objectify-appengine/ For further reading about JDO: https://developers.google.com/appengine/docs/java/datastore/jdo/overview-dn2 For further reading about JPA: https://developers.google.com/appengine/docs/java/datastore/jpa/overview 30 Google App Engine tutorial - 2013
  • 31. More features of GAE Sending mail from your server: You can send and receive emails on behalf of your project ID. Great for password recovery, confirm registration etc. For further reading about mailing options: https://developers.google.com/appengine/docs/java/mail/ 31 Google App Engine tutorial - 2013
  • 32. More features of GAE Logging messages to Logs console: You can log out notes of some categories: severe, warning and info. You can view your logs in the Logs section in your app’s console. Great for debugging  … … For further reading about logging: https://developers.google.com/appengine/docs/java/#Java_Logging 32 Google App Engine tutorial - 2013
  • 33. More features of GAE Running on local host: You can run your app locally. Do Run As > Web Application. Your server’s url now is http://localhost:8888/. You can get to your app’s console in: http://localhost:8888/_ah/admin. Note: you may need to remove your SSL protection (use http://...) when testing locally. 33 Google App Engine tutorial - 2013
  • 34. More features of GAE More relevant topics: • Transactions: atomic operations in the datastore. Obligatory for concurrent writes to datastore. https://developers.google.com/appengine/docs/java/datastore/transactions • ThreadSafe: allowing your server to run your server side in parallel. https://developers.google.com/appengine/docs/java/config/appconfig#Java_appengine_w eb_xml_Using_concurrent_requests • Backends: background services for heavy computations. https://developers.google.com/appengine/docs/java/backends/ •Blobstore: storing large files like images, videos etc. https://developers.google.com/appengine/docs/java/blobstore/ • Quotas: limits for free datastore usage. https://developers.google.com/appengine/docs/quotas#Datastore 34 Google App Engine tutorial - 2013
  • 35. Example source code https://drive.google.com/folderview?id=0B0ZJh5uX_P5iLXNQdXVZc2stSDQ&usp=sharing Daniel Abitbul – abitbul6@gmail.com Omer Shpigelman – omer.shpigelman@gmail.com 35 Google App Engine tutorial - 2013