SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
Guy Flysher

Google App Engine

(Google App Engine Overview)

Barcamp Phnom Penh 2011


Phnom Penh, Cambodia
About me

● Developer in the Emerging markets team.

● Joined Google in 2007.

● Previously worked on Social graphs,
  Gmail and Google Accounts.

● Currently work on SMS products (Chat SMS, G+ SMS and
  more to come...)

● G+ profile: http://gplus.name/GuyFlysher
Agenda


● Part I: What is App Engine?

● Part II: App Engine Product Usage

● Part III: How to use App Engine
   ○ Hello world example
   ○ App Engine Services
   ○ Code examples
   ○ Demos of non web uses
Why does App Engine exist?
App Engine is a full development platform


                       App Engine provides great
      Hosting          tools, APIs & hosting

                          Easy to build

        APIs              Easy to manage

                          Easy to scale

       Tools
Language Runtime Options




           GO
        Experimental       Java
App Engine APIs/Services

      Memcache    Datastore   URL Fetch




       Mail         XMPP      Task Queue




      Images      Blobstore   User Service
Administration Console
Agenda


● Part I: What is App Engine?

● Part II: App Engine Product Usage

● Part III: How to use App Engine
   ○ Hello world example
   ○ App Engine Services
   ○ Code examples
   ○ Demos of non web uses
App Engine - A Larger Number



1,500,000,000+
Page views per
day
Notable App Engine Customers
Royal Wedding - Scalability Success

                    Official blog & live stream apps
                         hosted on App Engine

                    On Wedding day...
                    Blog app served:
                       ● Up to 2k requests per second
                       ● 15 million pageviews
                       ● 5.6 million visitors
                    Live stream app served:
                       ● Up to 32k requests per second
                       ● 37.7 million pageviews
                       ● 13.7 million visitors



                      http://goo.gl/F1SGc
Not all apps user-facing or web-based!




● Need backend server processing? Want to build your own?
● Go cloud with App Engine!
● No UI needed for app to talk to App Engine, just need HTTP or XMPP
● Great place for user info e.g., high scores, contacts, levels/badges, etc.
● Better UI: move user data off phone & make universally available
Agenda


● Part I: What is App Engine?

● Part II: App Engine Product Usage

● Part III: How to use App Engine
   ○ Servlets and JSP files
   ○ Hello world example
   ○ App Engine Services and code examples
   ○ Demos of non web uses
Java HttpServlet

● Abstract class for processing HTTP requests.

● Override its methods for processing various HTTP requests,
  e.g:
    ○ doGet
    ○ doPost
    ○ doHead
    ○ etc

● Part of Java (not App Engine specific)
HttpServlet example

public class Hello_worldServlet extends HttpServlet {

    public void doGet(HttpServletRequest req,
     HttpServletResponse resp) throws IOException {

        String userIp = req.getRemoteAddr();
        resp.setContentType("text/plain");
        resp.getWriter().println("Hello, " + userIp);
    }
}
JSP - JavaServer Pages

● Used to create dynamically generated web pages based on
  HTML.


● A mix of Java and HTML.


● Can be though of as the Java equivalent of PHP.
JSP example

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html><head> <title> Welcome!</title></head><body>

<%
 if (request.getParameter("name") != null) {
%>
<p>Hello, <%= request.getParameter("name") %> </p>
<%
 } else {
%>
<p>Hello, stranger. </p>
<%
 }
%>
Hello World Demo

  Deploy from scratch
  (In under 3 minutes)
App Engine setup



                     Servlets and other Java
                     code




                   JSP, html and other static
                   files
App Engine setup




                   Configuration files
web.xml

Used to map URLs to the servlets that will handle them:
web.xml
web.xml

Used to map URLs to the servlets that will handle them:
App Engine Services

          The User Service
The user system

Building your own user system is a lot of work

 ● Needs to be very secure - destructive result if broken into.

 ● Needs to be very reliable - if it is down your app can't be
   used.

 ● Lots of other services you need to build - a recovery
   mechanism etc.
The Google user system

App Engine User Service lets you use Google's user
system for your app.
Benefits:

 ● Users don't need to create a new account to use your app,
   they can use their Google account

 ● Very secure, highly reliable.

 ● Already has recovery mechanisms etc.

 ● Very easy to use!
The User Service

Checking if a user is logged in:
 <%
   UserService userService = UserServiceFactory.getUserService();
   User user = userService.getCurrentUser();
   if (user != null) {
 %>

 <p>Hello, <%= user.getNickname() %> </p>!
 <p>Our records show your email as: <%= user.getEmail() %> </p>

 <%
   } else {
 %>

 <p>Hello! Please log in. </p>

 <%
   }
 %>
The User Service
Creating a sign in/out links
 <%
   UserService userService = UserServiceFactory.getUserService();
   User user = userService.getCurrentUser();
   if (user != null) {
 %>

 <p>Hello, <%= user.getNickname() %>!
 <p> <a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">Sign out </a></p>

 <%
     } else {
 %>
 <p><a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Sign in</a</p>
 ...
App Engine Services

       The XMPP (chat) Service
Sending a chat message
...

JID fromJid = new JID("gday-chat@appspot.com");
JID toJid = new JID("chatty.cathy@gmail.com");
Message msg = new MessageBuilder()
  .withRecipientJids(toJid)
  .withFromJid(fromJid)
  .withBody("Hi there. Is this easy or what?")
  .build();
 XMPPService xmpp = XMPPServiceFactory.getXMPPService();
 SendResponse status = xmpp.sendMessage(msg);
 boolean messageSent =
  (status.getStatusMap().get(toJid) ==
   SendResponse.Status.SUCCESS);

...
App Engine Services

          The Mail Service
Sending an email message
...

Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);

try {
   Message msg = new MimeMessage(session);
   msg.setFrom(new InternetAddress(
      "anything@my-app-name.appspotmail.com",
      "Guy's App Engine App"));
   msg.addRecipient(Message.RecipientType.TO,
      new InternetAddress("my.client@gmail.com"));
   msg.setSubject("You confirmation email");
   msg.setText("...");
   Transport.send(msg);

} catch (AddressException e) { ... }
  catch (MessagingException e) { ... }
  catch (UnsupportedEncodingException e) { ... }

...
Demos
!
         Q&A
More documentation and information:
 http://code.google.com/appengine
Backup
Receiving a chat message
Signup your app to receive chat messages
                               appengine-web.xml
 <inbound-services>
  <service>xmpp_message</service>
 </inbound-services>



                                     web.xml

<servlet>
  <servlet-name>xmppreceiver</servlet-name>
  <servlet-class>gday.ReceiveChatMessageServlet</servlet-class>
 </servlet>
 <servlet-mapping>
  <servlet-name>xmppreceiver</servlet-name>
  <url-pattern>/_ah/xmpp/message/chat/</url-pattern>
 </servlet-mapping>
Receiving a chat message

protected void doPost(HttpServletRequest req,
  HttpServletResponse resp)
  throws ServletException, IOException {

 XMPPService xmpp = XMPPServiceFactory.getXMPPService();
 Message message = xmpp.parseMessage(req);

 JID fromJid = message.getFromJid();
 String body = message.getBody();
 String emailAddress = fromJid.getId().split("/")[0];
 if (body.equalsIgnoreCase("hello")) {
   ...
 return;
 }

 ...

Contenu connexe

Tendances

An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJSYogesh singh
 
Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Marios Fakiolas
 
multiple views and routing
multiple views and routingmultiple views and routing
multiple views and routingBrajesh Yadav
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend DevelopersSergio Nakamura
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSArmin Vieweg
 
Angular 2 - How we got here?
Angular 2 - How we got here?Angular 2 - How we got here?
Angular 2 - How we got here?Marios Fakiolas
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015Chang W. Doh
 
Shaping up with angular JS
Shaping up with angular JSShaping up with angular JS
Shaping up with angular JSBrajesh Yadav
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Pamela Fox
 
AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for BeginnersEdureka!
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Max Klymyshyn
 
Asp.net page lifecycle
Asp.net page lifecycleAsp.net page lifecycle
Asp.net page lifecycleKhademulBasher
 
Advantages of AngularJS over jQuery
Advantages of AngularJS over jQueryAdvantages of AngularJS over jQuery
Advantages of AngularJS over jQueryDipendra Shekhawat
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014Matt Raible
 
Google Cloud Messaging
Google Cloud MessagingGoogle Cloud Messaging
Google Cloud MessagingAshiq Uz Zoha
 
Pinned Sites in Internet Explorer 9
Pinned Sites in Internet Explorer 9Pinned Sites in Internet Explorer 9
Pinned Sites in Internet Explorer 9Abram John Limpin
 

Tendances (20)

AngularJS
AngularJSAngularJS
AngularJS
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJS
 
Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...
 
multiple views and routing
multiple views and routingmultiple views and routing
multiple views and routing
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
 
Angular 2 - How we got here?
Angular 2 - How we got here?Angular 2 - How we got here?
Angular 2 - How we got here?
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015
 
Shaping up with angular JS
Shaping up with angular JSShaping up with angular JS
Shaping up with angular JS
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)
 
AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for Beginners
 
Directives
DirectivesDirectives
Directives
 
React django
React djangoReact django
React django
 
Angular js
Angular jsAngular js
Angular js
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013
 
Asp.net page lifecycle
Asp.net page lifecycleAsp.net page lifecycle
Asp.net page lifecycle
 
Advantages of AngularJS over jQuery
Advantages of AngularJS over jQueryAdvantages of AngularJS over jQuery
Advantages of AngularJS over jQuery
 
The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014The Art of AngularJS - DeRailed 2014
The Art of AngularJS - DeRailed 2014
 
Google Cloud Messaging
Google Cloud MessagingGoogle Cloud Messaging
Google Cloud Messaging
 
Pinned Sites in Internet Explorer 9
Pinned Sites in Internet Explorer 9Pinned Sites in Internet Explorer 9
Pinned Sites in Internet Explorer 9
 

Similaire à Google App Engine Overview - BarCamp Phnom Penh 2011

Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and UpdateChris Schalk
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10Chris Schalk
 
Home management WebApp presentation
Home management WebApp presentationHome management WebApp presentation
Home management WebApp presentationbhavesh singh
 
Utilizing HTML5 APIs
Utilizing HTML5 APIsUtilizing HTML5 APIs
Utilizing HTML5 APIsIdo Green
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineTahir Akram
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest FeaturesChris Schalk
 
Modern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsModern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsIdo Green
 
The web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulThe web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulRobert Nyman
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest FeaturesChris Schalk
 
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)Ido Green
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform UpdateIdo Green
 
How to build a website that works without internet using angular, service wor...
How to build a website that works without internet using angular, service wor...How to build a website that works without internet using angular, service wor...
How to build a website that works without internet using angular, service wor...Tomiwa Ademidun
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...Robert Nyman
 
Developing high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web workerDeveloping high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web workerSuresh Patidar
 

Similaire à Google App Engine Overview - BarCamp Phnom Penh 2011 (20)

Google App Engine Overview and Update
Google App Engine Overview and UpdateGoogle App Engine Overview and Update
Google App Engine Overview and Update
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 
Home management WebApp presentation
Home management WebApp presentationHome management WebApp presentation
Home management WebApp presentation
 
GDG Ibadan #pwa
GDG Ibadan #pwaGDG Ibadan #pwa
GDG Ibadan #pwa
 
Sujeet Gupta
Sujeet GuptaSujeet Gupta
Sujeet Gupta
 
Utilizing HTML5 APIs
Utilizing HTML5 APIsUtilizing HTML5 APIs
Utilizing HTML5 APIs
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In 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
 
Varaprasad-Go
Varaprasad-GoVaraprasad-Go
Varaprasad-Go
 
Modern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIsModern Web Applications Utilizing HTML5 APIs
Modern Web Applications Utilizing HTML5 APIs
 
The web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulThe web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - Istanbul
 
Google App Engine's Latest Features
Google App Engine's Latest FeaturesGoogle App Engine's Latest Features
Google App Engine's Latest Features
 
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)
Modern Web Applications Utilizing HTML5 (Dev Con TLV 06-2013)
 
Google Cloud Platform Update
Google Cloud Platform UpdateGoogle Cloud Platform Update
Google Cloud Platform Update
 
How to build a website that works without internet using angular, service wor...
How to build a website that works without internet using angular, service wor...How to build a website that works without internet using angular, service wor...
How to build a website that works without internet using angular, service wor...
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
Developing high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web workerDeveloping high performance and responsive web apps using web worker
Developing high performance and responsive web apps using web worker
 

Dernier

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Dernier (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Google App Engine Overview - BarCamp Phnom Penh 2011

  • 1. Guy Flysher Google App Engine (Google App Engine Overview) Barcamp Phnom Penh 2011 Phnom Penh, Cambodia
  • 2. About me ● Developer in the Emerging markets team. ● Joined Google in 2007. ● Previously worked on Social graphs, Gmail and Google Accounts. ● Currently work on SMS products (Chat SMS, G+ SMS and more to come...) ● G+ profile: http://gplus.name/GuyFlysher
  • 3. Agenda ● Part I: What is App Engine? ● Part II: App Engine Product Usage ● Part III: How to use App Engine ○ Hello world example ○ App Engine Services ○ Code examples ○ Demos of non web uses
  • 4. Why does App Engine exist?
  • 5. App Engine is a full development platform App Engine provides great Hosting tools, APIs & hosting Easy to build APIs Easy to manage Easy to scale Tools
  • 6. Language Runtime Options GO Experimental Java
  • 7. App Engine APIs/Services Memcache Datastore URL Fetch Mail XMPP Task Queue Images Blobstore User Service
  • 9. Agenda ● Part I: What is App Engine? ● Part II: App Engine Product Usage ● Part III: How to use App Engine ○ Hello world example ○ App Engine Services ○ Code examples ○ Demos of non web uses
  • 10. App Engine - A Larger Number 1,500,000,000+ Page views per day
  • 11. Notable App Engine Customers
  • 12. Royal Wedding - Scalability Success Official blog & live stream apps hosted on App Engine On Wedding day... Blog app served: ● Up to 2k requests per second ● 15 million pageviews ● 5.6 million visitors Live stream app served: ● Up to 32k requests per second ● 37.7 million pageviews ● 13.7 million visitors http://goo.gl/F1SGc
  • 13. Not all apps user-facing or web-based! ● Need backend server processing? Want to build your own? ● Go cloud with App Engine! ● No UI needed for app to talk to App Engine, just need HTTP or XMPP ● Great place for user info e.g., high scores, contacts, levels/badges, etc. ● Better UI: move user data off phone & make universally available
  • 14. Agenda ● Part I: What is App Engine? ● Part II: App Engine Product Usage ● Part III: How to use App Engine ○ Servlets and JSP files ○ Hello world example ○ App Engine Services and code examples ○ Demos of non web uses
  • 15. Java HttpServlet ● Abstract class for processing HTTP requests. ● Override its methods for processing various HTTP requests, e.g: ○ doGet ○ doPost ○ doHead ○ etc ● Part of Java (not App Engine specific)
  • 16. HttpServlet example public class Hello_worldServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String userIp = req.getRemoteAddr(); resp.setContentType("text/plain"); resp.getWriter().println("Hello, " + userIp); } }
  • 17. JSP - JavaServer Pages ● Used to create dynamically generated web pages based on HTML. ● A mix of Java and HTML. ● Can be though of as the Java equivalent of PHP.
  • 18. JSP example <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html><head> <title> Welcome!</title></head><body> <% if (request.getParameter("name") != null) { %> <p>Hello, <%= request.getParameter("name") %> </p> <% } else { %> <p>Hello, stranger. </p> <% } %>
  • 19. Hello World Demo Deploy from scratch (In under 3 minutes)
  • 20. App Engine setup Servlets and other Java code JSP, html and other static files
  • 21. App Engine setup Configuration files
  • 22. web.xml Used to map URLs to the servlets that will handle them:
  • 24. web.xml Used to map URLs to the servlets that will handle them:
  • 25. App Engine Services The User Service
  • 26. The user system Building your own user system is a lot of work ● Needs to be very secure - destructive result if broken into. ● Needs to be very reliable - if it is down your app can't be used. ● Lots of other services you need to build - a recovery mechanism etc.
  • 27. The Google user system App Engine User Service lets you use Google's user system for your app. Benefits: ● Users don't need to create a new account to use your app, they can use their Google account ● Very secure, highly reliable. ● Already has recovery mechanisms etc. ● Very easy to use!
  • 28. The User Service Checking if a user is logged in: <% UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { %> <p>Hello, <%= user.getNickname() %> </p>! <p>Our records show your email as: <%= user.getEmail() %> </p> <% } else { %> <p>Hello! Please log in. </p> <% } %>
  • 29. The User Service Creating a sign in/out links <% UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if (user != null) { %> <p>Hello, <%= user.getNickname() %>! <p> <a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">Sign out </a></p> <% } else { %> <p><a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Sign in</a</p> ...
  • 30.
  • 31.
  • 32.
  • 33. App Engine Services The XMPP (chat) Service
  • 34. Sending a chat message ... JID fromJid = new JID("gday-chat@appspot.com"); JID toJid = new JID("chatty.cathy@gmail.com"); Message msg = new MessageBuilder() .withRecipientJids(toJid) .withFromJid(fromJid) .withBody("Hi there. Is this easy or what?") .build(); XMPPService xmpp = XMPPServiceFactory.getXMPPService(); SendResponse status = xmpp.sendMessage(msg); boolean messageSent = (status.getStatusMap().get(toJid) == SendResponse.Status.SUCCESS); ...
  • 35. App Engine Services The Mail Service
  • 36. Sending an email message ... Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress( "anything@my-app-name.appspotmail.com", "Guy's App Engine App")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("my.client@gmail.com")); msg.setSubject("You confirmation email"); msg.setText("..."); Transport.send(msg); } catch (AddressException e) { ... } catch (MessagingException e) { ... } catch (UnsupportedEncodingException e) { ... } ...
  • 37. Demos
  • 38. ! Q&A More documentation and information: http://code.google.com/appengine
  • 40. Receiving a chat message Signup your app to receive chat messages appengine-web.xml <inbound-services> <service>xmpp_message</service> </inbound-services> web.xml <servlet> <servlet-name>xmppreceiver</servlet-name> <servlet-class>gday.ReceiveChatMessageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>xmppreceiver</servlet-name> <url-pattern>/_ah/xmpp/message/chat/</url-pattern> </servlet-mapping>
  • 41. Receiving a chat message protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { XMPPService xmpp = XMPPServiceFactory.getXMPPService(); Message message = xmpp.parseMessage(req); JID fromJid = message.getFromJid(); String body = message.getBody(); String emailAddress = fromJid.getId().split("/")[0]; if (body.equalsIgnoreCase("hello")) { ... return; } ...