SlideShare a Scribd company logo
1 of 44
Google Web Toolkit
      (GWT)
           by
     Sherif Elsbaey
AGENDA

 Introducing GWT
 Discover the GWT's benefits, capabilities
  and limitations
 Building User Interface
     GWT Widgets
     Event handling
     Apply styles
AGENDA
   Client-Side RPC Architecture
       GWT RPC
       Serializable type
       Handling Exception

   Create, develop, execute and deploy GWT
    Applications
   History management
   Internationalization
   JUnit Testing
   Javascript Native Interface (JSNI)
AGENDA

   GWT Best Practices
       Security Issues
       Performance Concerns
       The GWT Incremental-command class
       Caching in GWT
       GWT Design Considerations
       GWT Pitfalls and Issues
Introducing GWT
WHAT IS GWT?
 Java software development framework that makes
 writing AJAX applications easy
   Google announced GWT at the JavaOne 2006

 Let you develop and debug AJAX applications in the
 Java language using Java development tools
   Eclipse, Netbeans, IntelliJ, …

 Provides Java-to-Javascript compiler and
 development mode that helps you debug your GWT
 applications
GWT SDK & TOOLS
 GWT SDK: contains Java API
 libraries, compiler, development server and tools
 Plugin for Eclipse: provides IDE support for GWT
 and App Engine web projects
 Some other tools:
    GWT Designer

    Speed Tracer
TWO MODES OF RUNNING GWT APP
Development mode (hosted mode)
  GWT application is run as Java bytecode within JVM
  Take advantage of Java debugging



Production mode (web mode)
  Your GWT application is run as pure Javascript and HTML
  compiled from original Java source code
  End user will only see the web mode version of your
  application
Discover the GWT's
benefits, capabilities and
        limitations
BENEFITS
   Develop Rich Web Apps, utilize client CPUs
   GWT is ultimate Ajax
   Take advantage from rich built-in Widgets
   Build new generation of distributed apps
   GWT transmits a tiny fraction of data compared to traditional
    applications (should really be compared to real contenders – Java
    Applets/Flex/Silverlight)
   Leverage various tools of Java programming for
    writing, debugging, testing
       Ex: Eclipse, IntelliJ, Netbeans, …
   No need to take care of browser incompatibilities and quirks
      GWT compiler handles them
       Support browser history, backward, forward
CAPABILITIES
   Java-based Object-Oriented designs are easier to communicate
    and understand.
   Take advantage of Java refactoring, code completion, ...
   No need to write “excellent” Javascript code
       Leverage your Java programming knowledge

   JUnit integration
   Internationalization
   DOM management
LIMITATIONS
   Not all of JDK supported (enough for large projects though)
   JSON is not as natural as in JS, parsing is clunky
GWT VS ?
GWT ARCHITECTURE OVERVIEW
Building User Interface
GWT USER INTERFACE
   GWT user interface classes are similar to those
    in existing UI frameworks such as Swing and
    SWT.
      GWT widgets are rendered using dynamically-created HTML
      rather than pixel-oriented graphics

   The Widget classes make it easier to
    quickly build interfaces that will work
    correctly on all browsers.
WIDGETS LIBRARY
WIDGETS LIBRARY
WIDGETS LIBRARY
WIDGETS LIBRARY
EVENT HANDLER
   Events in GWT use the handler model
    similar to other user interface frameworks
      A handler interface defines one or more methods that the
      widget calls to announce an event

      A class wishing to receive events of a particular type
      implements the associated handler interface and then passes
      a reference to itself to the widget to subscribe to a set of
      events.
EVENT HANDLER
         Example

public void anonClickHandlerExample() {
    Button b = new Button("Click Me");
    b.addClickHandler(new ClickHandler() {
     public void onClick(ClickEvent event) {
          // handle the click event
     }
    });
}
APPLY STYLES
 GWT applications use CSS for visual
  styling
 Update styles dynamically in Java code

 Associate style sheets with the project
    Using a <link> tag in the host HTML page.

    Using the <stylesheet> element in the module XML file
Client-Side RPC Architecture
GWT REMOTE PROCEDURE CALL
   Mechanism for interacting with server by invoking a
    method
      Ex: fetching data from server

   GWT RPC makes it easy for the client and server to
    pass Java objects back and forth over HTTP
      provides serialization mechanism to bridge between client and server

      Any object that needs to send is a GWT Serialization type

   Proper use of GWT RPC can allow you to develop an
    application where all the UI logic resides on the
    client, leaving business logic on the server)
      Resulting in an application with greatly improved performance, reduced
      bandwidth, and reduced web server load
GWT-RPC DIAGRAM
                • Calls greetingService.greetserver(“Ron”)
Browser         • Client-side code serializes objects and generates
                RPC request payload
                • RPC Request is sent to the server



   POST /sample HTTP/1.1
   ..snip..
   5|0|6|http://gwtsite/sample/|29F
   4EA1240F157649C12466F01
   F46F60|com.test.client.Greetin
   gService|greetServer|java.lang
   .String|myInput|1|2|3|4|1|5|6|

                                                             GWT Service
GWT-RPC DIAGRAM
 Browser
                                    HTTP/1.1 200 OK
                                    ..snip..
                                    //OK[1,["Hello, Ron!<br><br>I am
                                    running jetty-6.1.x.<br><br>It
                                    looks like you are using:<br>
                                    Chrome/6.0.472.63"],0,5]



• Parses and deserializes the request payload
• Executes the greetingServer method
• Sends JSON serialized response to the client
                                                           GWT Service
GWT RPC PLUMBING ARCHITECTURE
IMPLEMENTING GWT RPC
   Define an interface for your service that extends
    RemoteService and lists all RPC method
       called “Synchronous Interface”

 Implement the service at server-side
    This class extends RemoteServiceServlet and implement the created
    interface

   Define an asynchronous interface to your service to be
    called from the client-side code
       Based on original service interface
       Require caller to pass callback object that can be notified when async
       call completes.
SERIALIZABLE TYPES
   GWT RPC method parameters and return types must be
    serializable
      These values will be transmitted across network between client and
      server

   Java data types are already serializable
      Primitive, such as char, byte, short, int, long, boolean, float, or double.

      String, Date or primitive wrapper:
      Character, Integer, Byte, Double, …

      Array of serializable types

      Serializable user-defined class
HANDLING EXCEPTION
   Making RPCs opens up the possibility of a variety
    of errors
      Networks fail, servers crash, and problems occur while
      processing a server call

   GWT lets you handle these conditions in terms of Java
    exceptions
   Caller should implement
    AsyncCallBack.onFailure(Throwable) to handle exception
Create, develop, execute and
  deploy GWT Applications
History management
GWT HISTORY MECHANISM
GWT applications use “history token” to help Ajax
developer activate browser history
   The token will be saved in browser history as a URL fragment

   Ex:
   http://www.example.com/historyexample/HistoryExample.html#page
   1

To enable history to your Ajax
   Add a history token to the history stack when you want to enable
   history event

   Create an object that implements the ValueChangeHandler interface,
   parses new token and changes the application state to match
Internationalization
INTERNATIONALIZATION
GWT offers multiple internationalization techniques
   Static String Internationalization

   Dynamic String Internationalization

Static String Internationalization
   Extends Constants Interface

   Extends Message Interface

   Use properties files

Dynamic String Internationalization
JUnit Testing
JUNIT TESTING
 GWT provides integration with the popular JUnit
 unit testing framework


 GWT allows JUnit test cases to run in either
 development mode or production mode.
Javascript Native Interface (JSNI)
WHY JSNI?
Sometimes it's very useful to mix handwritten Javascript to Java
source code
   Ex: access low-level browser functionality not exposed by the GWT API

You can use JSNI to:
   Implement a Java method directly in JavaScript

   Wrap type-safe Java method signatures around existing JavaScript

   Call from JavaScript code into Java code and vice-versa

   Throw exceptions across Java/JavaScript boundaries

   Read and write Java fields from JavaScript

   Use development mode to debug both Java source (with a Java debugger) and
   JavaScript (with a script debugger)
RESOURCES
http://code.google.com/webtoolkit/
   Main site for GWT

http://googlewebtoolkit.blogspot.com/
http://developerlife.com
Question & Answer

More Related Content

What's hot

Weaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
Weaving Through the Mesh: Making Sense of Istio and Overlapping TechnologiesWeaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
Weaving Through the Mesh: Making Sense of Istio and Overlapping TechnologiesVMware Tanzu
 
Developing Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsDeveloping Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsGR8Conf
 
Microservices - Event-driven & the hidden landmines
Microservices - Event-driven & the hidden landminesMicroservices - Event-driven & the hidden landmines
Microservices - Event-driven & the hidden landminesVijay Redkar
 
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20....Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...Javier García Magna
 
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Binary Studio
 
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Nokia
 
Introduction to the Nancy Framework
Introduction to the Nancy FrameworkIntroduction to the Nancy Framework
Introduction to the Nancy FrameworkTim Bourguignon
 
microservice architecture public education v2
microservice architecture public education v2microservice architecture public education v2
microservice architecture public education v2uEngine Solutions
 
Using Magnolia in a Microservices Architecture
Using Magnolia in a Microservices ArchitectureUsing Magnolia in a Microservices Architecture
Using Magnolia in a Microservices ArchitectureMagnolia
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkitchris be
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDotNetCampus
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwtsupertoy2015
 
Microservices Server - MSS Workshop
Microservices Server - MSS WorkshopMicroservices Server - MSS Workshop
Microservices Server - MSS WorkshopWSO2
 

What's hot (20)

Integration testing dropwizard
Integration testing dropwizardIntegration testing dropwizard
Integration testing dropwizard
 
Weaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
Weaving Through the Mesh: Making Sense of Istio and Overlapping TechnologiesWeaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
Weaving Through the Mesh: Making Sense of Istio and Overlapping Technologies
 
Developing Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with GrailsDeveloping Mobile HTML5 Apps with Grails
Developing Mobile HTML5 Apps with Grails
 
Micronaut Launchpad
Micronaut LaunchpadMicronaut Launchpad
Micronaut Launchpad
 
Microservices - Event-driven & the hidden landmines
Microservices - Event-driven & the hidden landminesMicroservices - Event-driven & the hidden landmines
Microservices - Event-driven & the hidden landmines
 
Eco system apps
Eco system appsEco system apps
Eco system apps
 
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20....Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
 
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
 
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
Introduction to the Nancy Framework
Introduction to the Nancy FrameworkIntroduction to the Nancy Framework
Introduction to the Nancy Framework
 
microservice architecture public education v2
microservice architecture public education v2microservice architecture public education v2
microservice architecture public education v2
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
 
Using Magnolia in a Microservices Architecture
Using Magnolia in a Microservices ArchitectureUsing Magnolia in a Microservices Architecture
Using Magnolia in a Microservices Architecture
 
Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)Scala & Lift (JEEConf 2012)
Scala & Lift (JEEConf 2012)
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Dnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforussoDnc2015 azure-microservizi-vforusso
Dnc2015 azure-microservizi-vforusso
 
T 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By GwtT 0230 Google Wave Powered By Gwt
T 0230 Google Wave Powered By Gwt
 
Microservices Server - MSS Workshop
Microservices Server - MSS WorkshopMicroservices Server - MSS Workshop
Microservices Server - MSS Workshop
 

Similar to Gwt session

Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programmingDmitry Buzdin
 
GWT: Our Experiences
GWT: Our ExperiencesGWT: Our Experiences
GWT: Our ExperiencesYenwen Feng
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Dmitry Buzdin
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitDidier Girard
 
GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day DNG Consulting
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet backdoor
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Toolsbarciszewski
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksSunil Patil
 

Similar to Gwt session (20)

Gwt Presentation1
Gwt Presentation1Gwt Presentation1
Gwt Presentation1
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
GWT Basics
GWT BasicsGWT Basics
GWT Basics
 
Web polyglot programming
Web polyglot programmingWeb polyglot programming
Web polyglot programming
 
GWT: Our Experiences
GWT: Our ExperiencesGWT: Our Experiences
GWT: Our Experiences
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
Ecom 1
Ecom 1Ecom 1
Ecom 1
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)Google Web Toolkit (JUG Latvia)
Google Web Toolkit (JUG Latvia)
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day GWT Introduction for Eclipse Day
GWT Introduction for Eclipse Day
 
Mlocjs buzdin
Mlocjs buzdinMlocjs buzdin
Mlocjs buzdin
 
GWT
GWTGWT
GWT
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
 
GWT- Google Web Toolkit
GWT- Google Web ToolkitGWT- Google Web Toolkit
GWT- Google Web Toolkit
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
 

Recently uploaded

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
"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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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...
 
"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 ...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Gwt session

  • 1. Google Web Toolkit (GWT) by Sherif Elsbaey
  • 2. AGENDA  Introducing GWT  Discover the GWT's benefits, capabilities and limitations  Building User Interface GWT Widgets Event handling Apply styles
  • 3. AGENDA  Client-Side RPC Architecture GWT RPC Serializable type Handling Exception  Create, develop, execute and deploy GWT Applications  History management  Internationalization  JUnit Testing  Javascript Native Interface (JSNI)
  • 4. AGENDA  GWT Best Practices Security Issues Performance Concerns The GWT Incremental-command class Caching in GWT GWT Design Considerations GWT Pitfalls and Issues
  • 6. WHAT IS GWT? Java software development framework that makes writing AJAX applications easy Google announced GWT at the JavaOne 2006 Let you develop and debug AJAX applications in the Java language using Java development tools Eclipse, Netbeans, IntelliJ, … Provides Java-to-Javascript compiler and development mode that helps you debug your GWT applications
  • 7. GWT SDK & TOOLS GWT SDK: contains Java API libraries, compiler, development server and tools Plugin for Eclipse: provides IDE support for GWT and App Engine web projects Some other tools: GWT Designer Speed Tracer
  • 8. TWO MODES OF RUNNING GWT APP Development mode (hosted mode) GWT application is run as Java bytecode within JVM Take advantage of Java debugging Production mode (web mode) Your GWT application is run as pure Javascript and HTML compiled from original Java source code End user will only see the web mode version of your application
  • 9.
  • 10.
  • 11. Discover the GWT's benefits, capabilities and limitations
  • 12. BENEFITS  Develop Rich Web Apps, utilize client CPUs  GWT is ultimate Ajax  Take advantage from rich built-in Widgets  Build new generation of distributed apps  GWT transmits a tiny fraction of data compared to traditional applications (should really be compared to real contenders – Java Applets/Flex/Silverlight)  Leverage various tools of Java programming for writing, debugging, testing Ex: Eclipse, IntelliJ, Netbeans, …  No need to take care of browser incompatibilities and quirks GWT compiler handles them Support browser history, backward, forward
  • 13. CAPABILITIES  Java-based Object-Oriented designs are easier to communicate and understand.  Take advantage of Java refactoring, code completion, ...  No need to write “excellent” Javascript code Leverage your Java programming knowledge  JUnit integration  Internationalization  DOM management
  • 14. LIMITATIONS  Not all of JDK supported (enough for large projects though)  JSON is not as natural as in JS, parsing is clunky
  • 18. GWT USER INTERFACE  GWT user interface classes are similar to those in existing UI frameworks such as Swing and SWT. GWT widgets are rendered using dynamically-created HTML rather than pixel-oriented graphics  The Widget classes make it easier to quickly build interfaces that will work correctly on all browsers.
  • 23. EVENT HANDLER  Events in GWT use the handler model similar to other user interface frameworks A handler interface defines one or more methods that the widget calls to announce an event A class wishing to receive events of a particular type implements the associated handler interface and then passes a reference to itself to the widget to subscribe to a set of events.
  • 24. EVENT HANDLER  Example public void anonClickHandlerExample() { Button b = new Button("Click Me"); b.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // handle the click event } }); }
  • 25. APPLY STYLES  GWT applications use CSS for visual styling  Update styles dynamically in Java code  Associate style sheets with the project Using a <link> tag in the host HTML page. Using the <stylesheet> element in the module XML file
  • 27. GWT REMOTE PROCEDURE CALL  Mechanism for interacting with server by invoking a method Ex: fetching data from server  GWT RPC makes it easy for the client and server to pass Java objects back and forth over HTTP provides serialization mechanism to bridge between client and server Any object that needs to send is a GWT Serialization type  Proper use of GWT RPC can allow you to develop an application where all the UI logic resides on the client, leaving business logic on the server) Resulting in an application with greatly improved performance, reduced bandwidth, and reduced web server load
  • 28. GWT-RPC DIAGRAM • Calls greetingService.greetserver(“Ron”) Browser • Client-side code serializes objects and generates RPC request payload • RPC Request is sent to the server POST /sample HTTP/1.1 ..snip.. 5|0|6|http://gwtsite/sample/|29F 4EA1240F157649C12466F01 F46F60|com.test.client.Greetin gService|greetServer|java.lang .String|myInput|1|2|3|4|1|5|6| GWT Service
  • 29. GWT-RPC DIAGRAM Browser HTTP/1.1 200 OK ..snip.. //OK[1,["Hello, Ron!<br><br>I am running jetty-6.1.x.<br><br>It looks like you are using:<br> Chrome/6.0.472.63"],0,5] • Parses and deserializes the request payload • Executes the greetingServer method • Sends JSON serialized response to the client GWT Service
  • 30. GWT RPC PLUMBING ARCHITECTURE
  • 31. IMPLEMENTING GWT RPC  Define an interface for your service that extends RemoteService and lists all RPC method called “Synchronous Interface”  Implement the service at server-side This class extends RemoteServiceServlet and implement the created interface  Define an asynchronous interface to your service to be called from the client-side code Based on original service interface Require caller to pass callback object that can be notified when async call completes.
  • 32. SERIALIZABLE TYPES  GWT RPC method parameters and return types must be serializable These values will be transmitted across network between client and server  Java data types are already serializable Primitive, such as char, byte, short, int, long, boolean, float, or double. String, Date or primitive wrapper: Character, Integer, Byte, Double, … Array of serializable types Serializable user-defined class
  • 33. HANDLING EXCEPTION  Making RPCs opens up the possibility of a variety of errors Networks fail, servers crash, and problems occur while processing a server call  GWT lets you handle these conditions in terms of Java exceptions  Caller should implement AsyncCallBack.onFailure(Throwable) to handle exception
  • 34. Create, develop, execute and deploy GWT Applications
  • 36. GWT HISTORY MECHANISM GWT applications use “history token” to help Ajax developer activate browser history The token will be saved in browser history as a URL fragment Ex: http://www.example.com/historyexample/HistoryExample.html#page 1 To enable history to your Ajax Add a history token to the history stack when you want to enable history event Create an object that implements the ValueChangeHandler interface, parses new token and changes the application state to match
  • 38. INTERNATIONALIZATION GWT offers multiple internationalization techniques Static String Internationalization Dynamic String Internationalization Static String Internationalization Extends Constants Interface Extends Message Interface Use properties files Dynamic String Internationalization
  • 40. JUNIT TESTING GWT provides integration with the popular JUnit unit testing framework GWT allows JUnit test cases to run in either development mode or production mode.
  • 42. WHY JSNI? Sometimes it's very useful to mix handwritten Javascript to Java source code Ex: access low-level browser functionality not exposed by the GWT API You can use JSNI to: Implement a Java method directly in JavaScript Wrap type-safe Java method signatures around existing JavaScript Call from JavaScript code into Java code and vice-versa Throw exceptions across Java/JavaScript boundaries Read and write Java fields from JavaScript Use development mode to debug both Java source (with a Java debugger) and JavaScript (with a script debugger)
  • 43. RESOURCES http://code.google.com/webtoolkit/ Main site for GWT http://googlewebtoolkit.blogspot.com/ http://developerlife.com