web applications of the future: combining jee6 & javafx

39
Developing Web Applications of the future - Combining JEE 6 & JavaFX

Upload: paul-bakker

Post on 07-Nov-2014

15.195 views

Category:

Technology


0 download

DESCRIPTION

This presentation shows the most important web related new futures in JEE 6, and how to combine JEE 6 and JavaFX to create interesting applications. Topics such as JAX-RS, JSF 2.0, EJB lite and JavaFX/JavaScript integration is discussed.

TRANSCRIPT

Page 1: Web Applications of the future: Combining JEE6 & JavaFX

Developing Web Applications of the future

-Combining JEE 6 & JavaFX

Page 2: Web Applications of the future: Combining JEE6 & JavaFX

Goal of this talk

New features in JEE 6Mixing JEE 6 and JavaFXA look into the near future

Page 3: Web Applications of the future: Combining JEE6 & JavaFX

About me

Paul Bakker Trainer Info Support NLJUG speaker Java Magazine author

EJB 3JSFSeamJavaFXSpringHibernateFlex

Page 4: Web Applications of the future: Combining JEE6 & JavaFX

Outline

JavaFX web applicationsJAX-RS RESTful servicesConnecting JavaFX to services

Outline

Page 5: Web Applications of the future: Combining JEE6 & JavaFX

One minute JavaFX intro

Sun’s RIA platformCompetes with Flex, Flash and Silverlight

A new languageJavaFX ScriptDeclarative UI programming

Page 6: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX key features

ExpressivenessEasy component creationAnimationJava integrationMedia supportWrite once, run anywhere...

Page 7: Web Applications of the future: Combining JEE6 & JavaFX

Current problems

No components!No layout managersNo selectable textTooling

Page 8: Web Applications of the future: Combining JEE6 & JavaFX

ProfilesEJB 3.0 => 3.1 (Lite)JSF 1.2 => 2.0JPA 1.0 => 2.0JAX-RS => New!WebBeans => New!

JEE 6 ingredients

Page 9: Web Applications of the future: Combining JEE6 & JavaFX

Using JEE 6

GlassFish V3EJB3.1, JSF 2.0 and JAX-RSNo WebBeans, Servlet 3.0 and JPA 2.0 yetOnly WAR deplyment

Page 10: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX HTMLJavaScript

JAX-RS JSF

EJB 3

JPA

HTTP

JEE 6 & JavaFXBrowser

Server

Desktop

JavaFX

Page 11: Web Applications of the future: Combining JEE6 & JavaFX

FaceletsAnnotation support

e.g. @ManagedBeanAJAX supportResource loadingProject Stages

2.0 highlightsJSF

Page 12: Web Applications of the future: Combining JEE6 & JavaFX

Integrating JSF & JavaFX

JSF renders to HTMLUse <applet> tagJavaScript for communication

All text oriented functionality => JSFAll flashy stuff => JavaFX

Page 13: Web Applications of the future: Combining JEE6 & JavaFX

Full page JavaFX

Too limited at this momentNavigation, bookmarks, scrolling...

Will be an option in future versionsOk for Swing / Desktop

Page 14: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX brower integration

AppletStageExtension Browser navigationScript evaluation

Call JavaScript methods

Page 15: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX calling JavaScript

Page 16: Web Applications of the future: Combining JEE6 & JavaFX

Server url

JavaFX uses web services to connect to the serverDo not hardcode the server urlUse FX.getParameter

Page 17: Web Applications of the future: Combining JEE6 & JavaFX

JSF page initialization

Use @ManagedProperty to inject a request parameter

Use @PostConstruct to initialize values

Page 18: Web Applications of the future: Combining JEE6 & JavaFX

JFXtras

Layout Managers MigLayout port

CompontentsDialogsUnit Testing

http://code.google.com/p/jfxtras/

Page 19: Web Applications of the future: Combining JEE6 & JavaFX

MigLayout example

Page 20: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX HTMLJavaScript

JAX-RS JSF

EJB 3

JPA

HTTP

JEE 6 & JavaFXBrowser

Server

Desktop

JavaFX

Page 21: Web Applications of the future: Combining JEE6 & JavaFX

Expose RESTful web servicesAnnotation basedEasily combined with EJB and JPA

But no @EJB injection (yet)

JAX-RS

Page 22: Web Applications of the future: Combining JEE6 & JavaFX

RESTful intro

Web style web servicesResources over HTTP

Uniform Interface

Addressability

Connectedness

Statelessness

Page 23: Web Applications of the future: Combining JEE6 & JavaFX

@PathResource class root pathA sub-resource

JAX-RS

Page 24: Web Applications of the future: Combining JEE6 & JavaFX

@GETMethod handling GET requests

@ProducesContent type supported

@PathParamExtract value from URI template

JAX-RS

Page 25: Web Applications of the future: Combining JEE6 & JavaFX

Using JPA

Use out-of-container JPA confgurationUse EJB (Lite) Session Beans Lookup

Global JNDI namespace@EJB

Use Session Bean as resourceMight not be in JEE 6

Page 26: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX HTMLJavaScript

JAX-RS JSF

EJB 3

JPA

HTTP

JEE 6 & JavaFXBrowser

Server

Desktop

JavaFX

Page 27: Web Applications of the future: Combining JEE6 & JavaFX

lite

No interface requiredRuns in the web profileNo Message Driven BeansNo remote interfaceNo Timer serviceNo EJB 2.x compatibility

EJB 3

Page 28: Web Applications of the future: Combining JEE6 & JavaFX

EJB 3.1 lite Session Bean

Page 29: Web Applications of the future: Combining JEE6 & JavaFX

Global JNDI namespace

A portable namespace

java:global[/<app-name>]/<module-name>/<bean-name>

Page 30: Web Applications of the future: Combining JEE6 & JavaFX

Using Global JNDI

MobileShopServices.war

Page 31: Web Applications of the future: Combining JEE6 & JavaFX

Converting

JAXB

Resource Entity

ConverterXML

Request

Response

Page 32: Web Applications of the future: Combining JEE6 & JavaFX

Converting Entities

Each Entity has two convertersA single Entity converterA list converter

A JAXB annotated wrapper class

Page 33: Web Applications of the future: Combining JEE6 & JavaFX

Converter example

Page 34: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX web service API

JavaFX style HTTP callsPull style parsing

XML and JSON supportedREST only (no SOAP)

Page 35: Web Applications of the future: Combining JEE6 & JavaFX
Page 36: Web Applications of the future: Combining JEE6 & JavaFX

JavaFX Production Suite

Designer => Developer

Workflow

Page 37: Web Applications of the future: Combining JEE6 & JavaFX

Production SuiteWorkflow

PhotoshopPlace all

elements on scene

Add action handlers

Add animation

Replace dummy

elements

Page 38: Web Applications of the future: Combining JEE6 & JavaFX

More about this

June 29: Summer ClassBert Ertman & Paul Bakker

Page 39: Web Applications of the future: Combining JEE6 & JavaFX

More about this

June 29: Summer ClassJSF 2.0Servlet 3.0EJB 3.1 (lite)JPA 2.0WebBeansJAX-RSJavaFX (including new beta)