Gwt development with errai and forge


Published on

Talk di Luca Masini alla DevFest 2012 @ Firenze

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Gwt development with errai and forge

  1. 1. GDG FirenzeLuca Masini
  2. 2. GWT development with Errai and ForgeHow to use the same development model on client/server with Errai/Forge
  3. 3. Why GWT ?● With the arise of AJAX and Web 2.0 GWT is the only tool that allows a single programming language on client and server● The problem is that the development environments (API and platform) are really different
  4. 4. Here comes ErraiWith Errai you can use a single model todevelop all your applications: Java EE 6 with itsCDI capabilities and its RESTful services
  5. 5. Optional Modules● Automatic Data Binding between POJOs and UI● A template system that is far better than UIBinder● JPA for the WebSQL DB● optional simple and powerful bidirectional Message Bus between the client and the server
  6. 6. And what about Forge ?When you start a new project you can:● start from scratch, googling for configuration and the initial code skeleton● use a Maven Archetype (not really interactive)● use JBoss Forge to create the scaffold that you really need in your project
  7. 7. Forge: developers BASH● It creates only applications that use standard technologies (Java language, Java EE programming model)● No Forge APIs or configuration files on your code● Once your project is configured, you can forget about Forge, or may use it as your dev shell, your taste
  8. 8. Forge helps us: scaffolding
  9. 9. CDI with Errai unveiled● Create a GWTs EntryPoint with a simple bean and the @EntryPoint annotation● The @PostConstruct method will instruct how to bootstrap your application● You can do communication over the Errai Bus using only CDI event ○ client code ○ server code
  10. 10. CDI with Errai unveiled
  11. 11. Errai JAX-RS● Forge helps us creating the jax-rs setup● You can call a RESTful end-point only using jax-rs API within the CDI container● You can use a Jackson-compatible marshalling/unmarshalling JSON
  12. 12. Errai JAX-RS
  13. 13. Errai UI● Put your HTML5 template into your Java packages● Annotate your Composite with @Templated and you are done!● You can also inject Widgets inside the template and of course attach event to those widgets
  14. 14. Errai Data Binding● A POJO annotated with @Bindable can be injected into a Composite as a DataBinder● When the Composite is annotated with @Templated then the binding betweeen fields and widgets is implicit● We can also register a custom Converter, global or local to a property
  15. 15. Errai UI and DataBinding
  16. 16. Errais Portable Objects● We mark objects that need to travel between client and server with the @Portable annotation● Many strategies for construction and injection● Same API on client and on server
  17. 17. Conclusions● Forge helps us tailoring new projects for our needs and working in a productive way on existing ones● Errai lets us write less and better code with a common paradigm between client and server● Errai has also many addional modules that complete our client coding experience (HTML5 UI, Data Bindind, RESTful client)
  18. 18. References● The History and Future of GWT: http://go● Innovation Award 2012, JBoss Forge: http://jax-awards. com/proposal_technology.php?id=599&show=more● Errais project leader in the GWT Steering Committee: html
  19. 19. Q&A
  20. 20. <Thank You!>