SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
GWT, CDI & JAX-RS
    “A match made in heaven”
  Heiko Braun <hbraun@redhat.com>
About me
•   Heiko Braun
•   Senior Software Engineer JBoss / Red Hat
•   4 years JBoss, 12 years industry
•   Focus on SOA, BPM, GWT
•   Contributor:
    JBossWS, jBPM, Riftsaw, Errai, SAM, Savarra

    > http://jboss.org
Topics


•   GWT ecosystem
•   Integrating with CDI
•   When to use JAX-RPC
GWT ecosystem
GWT: Strong client side
•   GWT SDK: Tools & API to build Ajax clients &
    frameworks

•   Integration capabilities:
    - GWT RPC
    - XHR (Request Builder)

•   Data formats: JSON, XML

•   Rich set of widget libraries:
    - Mosaic, Smart GWT, etc
GWT: Weak server side

•   Service implementation choice:
    - rely on GWT RPC
    - or handle the low level protocol manually
•   Existing domain & component model?
    - Adapters, DTO’s, parallel hierarchy, etc
    - TX, Security, etc
•   A lot of boilerplate needs to be written
Backend implementation
       options
Java EE choices

•   CDI: Context and dependency injection for
    the EE platform
    (http://jcp.org/en/jsr/summary?id=299)
•   Java API for RESTful web services
    (http://jcp.org/en/jsr/detail?id=311)
•   Both part of EE 6
Relation to Errai

•   CDI integration build on Errai
    (http://jboss.org/errai)
•   Integration is actually an extension to Errai
    and vice versa
•   Knowledge about Errai Message Bus helpful,
    but not mandatory
GWT & CDI
GWT & CDI goals
•   Similar to GWT-RPC:

    •   re-use domain model

    •   transparent wire protocol (serialization)

•   In addition to GWT-RPC:

    •   Bypass the servlet tier (merely transport)

    •   Deep integration with EE component model

    •   Richer programming model & reduction of boiler
        plate
CDI Concepts
•   Portable Extensions

    •   Integration point when container bootstraps

    •   Create beans, annotation processing, meta data
        modifications

•   Scope & Lifecycle

    •   ApplicationScoped, RequestScoped, ConversationScoped

•   Bean context & reference

    •   Lookup and instance (reference) creation


                                12
GWT & CDI Samples
Using Pub/Sub
                               GWT Client

•   Most low level use cases
    (Errai Bus, Pub/Sub)

•   Similar to MessageDriven
    Bean
    (actual maps to it)        CDI Component


•   Service implementation
    fully managed by CDI
    container

•   Message Bus instance
    injected



                                14
Exposing RPC endpoints
                             GWT Client



•   Exposes a typed
    interface

•   Similar to EJB Session
    beans
    (maps to it)             CDI Component



•   RPC style, type safe
                               Remote interface
    client API




                                 15
Working with CDI events
                                 GWT Client



•   Bi-directional event
    exchange

•   Discriminate on:
    - Event Type
    - Qualifier Annotations
                                 CDI Component

•   Exposes high level CDI
    client API

•   Integrate with default and
    custom CDI events


                                         16
When to integrate with
        CDI

•   Benefits of Java EE 6 and GWT as an
    alternative view layer technology
•   Concise Java component model
•   Tool chain: GWT, EJB, CDI, JPA, JCA, JMS




                        17
GWT & JAX-RPC
GWT & JAX-RPC goals
•   RESTful web services:
    - RESTful API: open to non-java clients
    - Intermediaries: proxies, gateways, firewalls
    - [...] (See other Jazoon talks on this topic)

•   Expose low level protocol with a decent API

•   Directly expose XML, HTML from other resources
    - BIRT reporting (mashup, iframe)
    - Use of XML documents

•   Integrate with XHR (RequestBuilder)

•   Reuse domain model (serialization)
JAX-RPC Concepts
@Path("/customerservice/")
@Produces("application/xml")
public class CustomerService {

    @GET
    @Path("/customers/{id}")
    @Produces("application/json")
    public Customer getCustomer(@PathParam("id") String id) {
        ......
    }

    @PUT
    @Path("/customers/{id}")
    @Consumes("application/xml")
    public Response updateCustomer(@PathParam("id") Long id, Customer customer) {
        ......
    }

    @POST
    @Path("/customers")
    public Response addCustomer(Customer customer) {
        ......
    }

    @DELETE
    @Path("/customers/{id}/")
    public Response deleteCustomer(@PathParam("id") String id) {
        ......
    }
}
GWT & JAX-RPC
   samples
Request a JAX-RPC
            resource
GWT Client




Server Resource
Conclusion

•   CDI integration probably most reasonable choice for
    within EE 6 environments

    •   Integration & boilerplate missing: Errai [1] to the rescue

•   JAX-RPC is more open, but very low level.
    Still better then writing your own servlet code

•   Remember: You can mix and match JAX-RPC and CDI
    within the same components (at least on JBoss 6)



[1] http://anonsvn.jboss.org/repos/errai/projects/weld-integration/trunk/
Q&A
> http://jboss.org/errai
> http://errai-blog.blogspot.com/
Appendix A:
Errai Message Bus
Errai Basics
•   Backbone to application
    design

•   Federated architecture

•   Asynchronous & bi-
    directional

•   Supports POJO
    serialization

•   Common shared API

•   Supports OpenHUB spec

•   HTTP + NIO
Errai API
Publisher




Subscriber

Weitere ähnliche Inhalte

Was ist angesagt?

How the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendorsHow the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendors
WSO2
 
Better Enterprise Integration With the WSO2 ESB 4.5.1
Better Enterprise Integration With the WSO2 ESB 4.5.1Better Enterprise Integration With the WSO2 ESB 4.5.1
Better Enterprise Integration With the WSO2 ESB 4.5.1
WSO2
 
How to process Flat Files documents (TXT, CSV …) in BizTalk Server
How to process Flat Files documents (TXT, CSV …) in BizTalk ServerHow to process Flat Files documents (TXT, CSV …) in BizTalk Server
How to process Flat Files documents (TXT, CSV …) in BizTalk Server
Sandro Pereira
 

Was ist angesagt? (20)

WCF LOB SDK at CNUG
WCF LOB SDK at CNUGWCF LOB SDK at CNUG
WCF LOB SDK at CNUG
 
How the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendorsHow the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendors
 
Better Enterprise Integration With the WSO2 ESB 4.5.1
Better Enterprise Integration With the WSO2 ESB 4.5.1Better Enterprise Integration With the WSO2 ESB 4.5.1
Better Enterprise Integration With the WSO2 ESB 4.5.1
 
Building Microservices with gRPC and NATS
Building Microservices with gRPC and NATSBuilding Microservices with gRPC and NATS
Building Microservices with gRPC and NATS
 
Session 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, ServletsSession 25 - Introduction to JEE, Servlets
Session 25 - Introduction to JEE, Servlets
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
 
ESB integration for node.js
ESB integration for node.js ESB integration for node.js
ESB integration for node.js
 
World Wide Web
World Wide WebWorld Wide Web
World Wide Web
 
An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
 
Lamar University CAS HA
Lamar University CAS HALamar University CAS HA
Lamar University CAS HA
 
eGrove Systems - "SOLR" An Apache Product
eGrove Systems - "SOLR" An Apache ProducteGrove Systems - "SOLR" An Apache Product
eGrove Systems - "SOLR" An Apache Product
 
Alfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankAlfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European Bank
 
Implementing portlets using Web Scripts
Implementing portlets using Web ScriptsImplementing portlets using Web Scripts
Implementing portlets using Web Scripts
 
CodeIgniter
CodeIgniterCodeIgniter
CodeIgniter
 
eGrove Systems Review - "Features of Magento 2.0"
eGrove Systems Review - "Features of Magento 2.0"eGrove Systems Review - "Features of Magento 2.0"
eGrove Systems Review - "Features of Magento 2.0"
 
BizTalk Server 2009 ESB Guidance 2.0 By Kevin Gock
BizTalk Server 2009  ESB Guidance 2.0 By Kevin GockBizTalk Server 2009  ESB Guidance 2.0 By Kevin Gock
BizTalk Server 2009 ESB Guidance 2.0 By Kevin Gock
 
How to process Flat Files documents (TXT, CSV …) in BizTalk Server
How to process Flat Files documents (TXT, CSV …) in BizTalk ServerHow to process Flat Files documents (TXT, CSV …) in BizTalk Server
How to process Flat Files documents (TXT, CSV …) in BizTalk Server
 
(ATS4-DEV10) Creating Pipeline Pilot Components by Wrapping Third-Party Tools
(ATS4-DEV10) Creating Pipeline Pilot Components by Wrapping Third-Party Tools(ATS4-DEV10) Creating Pipeline Pilot Components by Wrapping Third-Party Tools
(ATS4-DEV10) Creating Pipeline Pilot Components by Wrapping Third-Party Tools
 
Mule ESB Intro
Mule ESB IntroMule ESB Intro
Mule ESB Intro
 
Introduction to SalesForce
Introduction to SalesForceIntroduction to SalesForce
Introduction to SalesForce
 

Ähnlich wie Gwt cdi jaxrs_hbraun

Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
Dobrica Pavlinušić
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 
Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)
Christian Posta
 

Ähnlich wie Gwt cdi jaxrs_hbraun (20)

apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
 
Gwt cdi jud_con_berlin
Gwt cdi jud_con_berlinGwt cdi jud_con_berlin
Gwt cdi jud_con_berlin
 
SOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class LibrariesSOLID Programming with Portable Class Libraries
SOLID Programming with Portable Class Libraries
 
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
Net framework
Net frameworkNet framework
Net framework
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
S2GX 2012 - Introduction to Spring Integration and Spring Batch
S2GX 2012 - Introduction to Spring Integration and Spring BatchS2GX 2012 - Introduction to Spring Integration and Spring Batch
S2GX 2012 - Introduction to Spring Integration and Spring Batch
 
Vaadin, Rich Web Apps in Server-Side Java without Plug-ins or JavaScript: Joo...
Vaadin, Rich Web Apps in Server-Side Java without Plug-ins or JavaScript: Joo...Vaadin, Rich Web Apps in Server-Side Java without Plug-ins or JavaScript: Joo...
Vaadin, Rich Web Apps in Server-Side Java without Plug-ins or JavaScript: Joo...
 
REST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookREST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical Look
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
 
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
 
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
Node.js BFFs - our way to the better/micro frontends
Node.js BFFs - our way to the better/micro frontendsNode.js BFFs - our way to the better/micro frontends
Node.js BFFs - our way to the better/micro frontends
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
 
Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)Kubernetes Ingress to Service Mesh (and beyond!)
Kubernetes Ingress to Service Mesh (and beyond!)
 
Apache Geode Meetup, London
Apache Geode Meetup, LondonApache Geode Meetup, London
Apache Geode Meetup, London
 
JBoss Fuse Service Works
JBoss Fuse Service WorksJBoss Fuse Service Works
JBoss Fuse Service Works
 

Mehr von hbraun (8)

AS7 Console 2013
AS7 Console 2013AS7 Console 2013
AS7 Console 2013
 
One daytalk hbraun_oct2011
One daytalk hbraun_oct2011One daytalk hbraun_oct2011
One daytalk hbraun_oct2011
 
Errai Workspaces
Errai WorkspacesErrai Workspaces
Errai Workspaces
 
Patterns&Practices-Errai
Patterns&Practices-ErraiPatterns&Practices-Errai
Patterns&Practices-Errai
 
Errai Workspaces
Errai WorkspacesErrai Workspaces
Errai Workspaces
 
Jug Zurich Slides
Jug Zurich SlidesJug Zurich Slides
Jug Zurich Slides
 
GWT Jug Stuttgart
GWT Jug StuttgartGWT Jug Stuttgart
GWT Jug Stuttgart
 
Jbpm4 Deployer
Jbpm4 DeployerJbpm4 Deployer
Jbpm4 Deployer
 

Kürzlich hochgeladen

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

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
 
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
 
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...
 
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
 
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
 
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...
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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...
 
+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...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 

Gwt cdi jaxrs_hbraun

  • 1. GWT, CDI & JAX-RS “A match made in heaven” Heiko Braun <hbraun@redhat.com>
  • 2. About me • Heiko Braun • Senior Software Engineer JBoss / Red Hat • 4 years JBoss, 12 years industry • Focus on SOA, BPM, GWT • Contributor: JBossWS, jBPM, Riftsaw, Errai, SAM, Savarra > http://jboss.org
  • 3. Topics • GWT ecosystem • Integrating with CDI • When to use JAX-RPC
  • 5. GWT: Strong client side • GWT SDK: Tools & API to build Ajax clients & frameworks • Integration capabilities: - GWT RPC - XHR (Request Builder) • Data formats: JSON, XML • Rich set of widget libraries: - Mosaic, Smart GWT, etc
  • 6. GWT: Weak server side • Service implementation choice: - rely on GWT RPC - or handle the low level protocol manually • Existing domain & component model? - Adapters, DTO’s, parallel hierarchy, etc - TX, Security, etc • A lot of boilerplate needs to be written
  • 8. Java EE choices • CDI: Context and dependency injection for the EE platform (http://jcp.org/en/jsr/summary?id=299) • Java API for RESTful web services (http://jcp.org/en/jsr/detail?id=311) • Both part of EE 6
  • 9. Relation to Errai • CDI integration build on Errai (http://jboss.org/errai) • Integration is actually an extension to Errai and vice versa • Knowledge about Errai Message Bus helpful, but not mandatory
  • 11. GWT & CDI goals • Similar to GWT-RPC: • re-use domain model • transparent wire protocol (serialization) • In addition to GWT-RPC: • Bypass the servlet tier (merely transport) • Deep integration with EE component model • Richer programming model & reduction of boiler plate
  • 12. CDI Concepts • Portable Extensions • Integration point when container bootstraps • Create beans, annotation processing, meta data modifications • Scope & Lifecycle • ApplicationScoped, RequestScoped, ConversationScoped • Bean context & reference • Lookup and instance (reference) creation 12
  • 13. GWT & CDI Samples
  • 14. Using Pub/Sub GWT Client • Most low level use cases (Errai Bus, Pub/Sub) • Similar to MessageDriven Bean (actual maps to it) CDI Component • Service implementation fully managed by CDI container • Message Bus instance injected 14
  • 15. Exposing RPC endpoints GWT Client • Exposes a typed interface • Similar to EJB Session beans (maps to it) CDI Component • RPC style, type safe Remote interface client API 15
  • 16. Working with CDI events GWT Client • Bi-directional event exchange • Discriminate on: - Event Type - Qualifier Annotations CDI Component • Exposes high level CDI client API • Integrate with default and custom CDI events 16
  • 17. When to integrate with CDI • Benefits of Java EE 6 and GWT as an alternative view layer technology • Concise Java component model • Tool chain: GWT, EJB, CDI, JPA, JCA, JMS 17
  • 19. GWT & JAX-RPC goals • RESTful web services: - RESTful API: open to non-java clients - Intermediaries: proxies, gateways, firewalls - [...] (See other Jazoon talks on this topic) • Expose low level protocol with a decent API • Directly expose XML, HTML from other resources - BIRT reporting (mashup, iframe) - Use of XML documents • Integrate with XHR (RequestBuilder) • Reuse domain model (serialization)
  • 20. JAX-RPC Concepts @Path("/customerservice/") @Produces("application/xml") public class CustomerService { @GET @Path("/customers/{id}") @Produces("application/json") public Customer getCustomer(@PathParam("id") String id) { ...... } @PUT @Path("/customers/{id}") @Consumes("application/xml") public Response updateCustomer(@PathParam("id") Long id, Customer customer) { ...... } @POST @Path("/customers") public Response addCustomer(Customer customer) { ...... } @DELETE @Path("/customers/{id}/") public Response deleteCustomer(@PathParam("id") String id) { ...... } }
  • 21. GWT & JAX-RPC samples
  • 22. Request a JAX-RPC resource GWT Client Server Resource
  • 23. Conclusion • CDI integration probably most reasonable choice for within EE 6 environments • Integration & boilerplate missing: Errai [1] to the rescue • JAX-RPC is more open, but very low level. Still better then writing your own servlet code • Remember: You can mix and match JAX-RPC and CDI within the same components (at least on JBoss 6) [1] http://anonsvn.jboss.org/repos/errai/projects/weld-integration/trunk/
  • 26. Errai Basics • Backbone to application design • Federated architecture • Asynchronous & bi- directional • Supports POJO serialization • Common shared API • Supports OpenHUB spec • HTTP + NIO