SlideShare a Scribd company logo
1 of 42
Download to read offline
Project Avatar:

Server Side JavaScript on the JVM
QCon London 2014
!
David Delabassee
@delabassee

Software Evangelist - Oracle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!2
The following is intended to outline our general product direction.
It is intended for information purposes only, and may not be
incorporated into any contract. It is not a commitment to deliver
any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and
timing of any features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!3
"The French and the British are such good enemies
that they can't resist being friends."
(Peter Ustinov)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!4
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!5
Agenda
▪ Web Application Architecture Evolution
▪ JavaScript and Node on the JVM
▪ Project Avatar – Advanced JavaScript Services
▪ Avatar Client Framework
▪ Summary
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!6
Evolution of Web Application Architecture
A Java EE Perspective
ClientServer
Presentation
!
(Servlet/JSP)
EnterpriseConnectivity

andBusinessLogic
Http
▪ Request / Response
▪ Multi-Page Application
Browser
Java EE / JVM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!7
Evolution of Web Application Architecture
A Java EE Perspective
Presentation
!
(Servlet/JSP,

JSF)
Connectivity


(REST

SSE)
EnterpriseConnectivity

andBusinessLogic
Http
REST
Java EE / JVM
▪ Multi-Page Application
▪ In-page updates (AJAX)
JavaScript
Browser
ClientServer
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!8
Modern Web Application Architecture
A Java EE Perspective
Http, REST
REST, SSE, WebSockets
Presentation
!
(Servlet/JSP,

JSF)
Connectivity


(WebSocket,

REST,SSE)
EnterpriseConnectivity

andBusinessLogic
Java EE / JVM
▪ Single-page applications
▪ View/Controller in browser
▪ Model on server
View
Controller
JavaScript
Browser
ClientServer
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!9
Java EE – The Latest in Enterprise Java
ENTERPRISE
EDITIONDEVELOPER
PRODUCTIVITY
MEETING 

ENTERPRISE
DEMANDS
Java EE 7
▪ Batch
▪ Concurrency
▪ Simplified JMS
▪ More annotated POJOs
▪ Less boilerplate code
▪ Cohesive integrated 

platform
▪ WebSockets
▪ JSON
▪ Servlet 3.1 NIO
▪ REST
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!10
Node.js
▪ Server-side JavaScript based on Chrome v8 engine
▪ Created by Ryan Dahl (2009), Open Source
▪ Designed for fast, scalable network applications
▪ Event-driven, non-blocking I/O model
▪ “Melting pot community”
– JavaScript, Java, .NET, PHP, …
– Very active, with 60,000+ modules
Server Side JavaScript
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!11
Node.js Programming Model
▪ Single threaded
▪ Event-loop
– Callback model
– Non-blocking I/O calls
▪ Heavily parallelized
– User code: sequential
▪ Multi-threading is hard
– Thousands of concurrent connections
– Deal with deadlocks and race conditions
▪ Blocking I/O is bad
HTTP Callback Example:
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!12
Node.js Event Loop
Single-Threaded

Event Loop
Resource-
Intensive
Operations
Network
File System
Network
Compute
Register Callback
CompleteOperation
Client
Requests
(Http)
Response
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!13
Evolution of Web Application Architecture
Mobile-enabling existing services
REST/SSE/WebSockets
JavaScript
▪ Project-based end-to-end JavaScript
▪ Rapid prototyping & API layer
▪ Leverage backend resources
▪ Aggregate & transform content
▪ Return JSON to browser
View
Controller
JavaScript
Browser
ClientServer
Node
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!14
ClientServer
Evolution of Web Application Architecture
Mobile-enabling existing services
EnterpriseConnectivity

andBusinessLogic
Java EE / JVM
JavaScript
What if we could run Node

alongside Java EE in

the same JVM?
View
Controller
JavaScript
Browser
REST / SSE/ WebSockets
Node
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!15
JavaScript and Node

on the JVM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!16
Project Nashorn
▪ ECMAScript 5.1 compliant
▪ Bundled with JDK 8
– Replaces Rhino
– Faster (2x – 10x)
– More secure
▪ Seamless Java ßà JavaScript interoperability
JavaScript on the JVM
http://download.java.net/jdk8/docs/technotes/guides/scripting/nashorn/index.html
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!17
Avatar.js
▪ Platform for server side JavaScript applications
▪ Requires Nashorn (JDK 8)
▪ 95% Node compatibility
– Use popular packages (Express, async, commander, etc)
– Uses same portability libraries as Node.js
– Limitation: No Chrome v8 native APIs
▪ Avatar.js Advantages
– Leverage Java frameworks, libraries and tools
– Security manager
Node on the JVM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!18
Avatar.js = Node + Java
▪ Node Programming Model
– Code in JavaScript
– Single event loop / thread
– Require (import) Node modules
▪ Invoke Java code
– Java types and libraries
– new java.lang.Thread();!
– new com.myorg.MyObj();
Leverage Java, including Threads
Java
JavaScript
java.lang.Thread
java.util.SortedSet
java.math.BigInteger
Node App
JVM Process
com.myorg.MyObj
require (‘async’)
postEvent()
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!19
Project Avatar:

Advanced JavaScript Services



Leveraging Java EE
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!20
Project Avatar
▪ Similar in spirit to Servlets, but focused on REST, WebSocket,
Server Sent Event (SSE) endpoints
▪ Use familiar Node.js event-driven programming model and modules
▪ Layers on Avatar.js Node-compatible runtime
▪ Adds integrated enterprise features
A Server Side JavaScript Services Framework
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!21
Project Avatar
▪ Multi-threading, lightweight message passing, no mutable
shared state
▪ Model Store – Object Relational Mapping
▪ HTTP listener / load-balancer managed by framework
▪ Messaging – JMS on Java EE container
Leveraging the JVM and Java EE
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!22
Avatar Architecture - Server
Server Database
Data
Notification
JDK 8 / Nashorn
Avatar Runtime
Node Modules
Avatar Modules
Server Runtime (Java EE)
Application
Services
= Java framework
= JavaScript framework
= Application code
Avatar.js
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!23
Avatar Services
Multi-core, state sharing, data storage
Java
JVM Process
JavaScript
Services Services ServicesServices
Database
Data
Notification
shared state
JSON JSON JSON JSON
HTTP Load Balancer
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!24
Shared State
▪ Two Models
– MessageBus
▪ Publish/subscribe message passing
– Shared State
▪ Simple map API
▪ Application-scoped instance
▪ Session-scoped instance
– Named
– Leased, with configurable timeout
▪ Provide required serialization, concurrency, and caching
Lightweight inter-thread communication
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!25
State Sharing Example
var avatar = require(‘org/glassfish/avatar’);!
var threads = require(‘org/glassfish/avatar/threads’);!
var app = avatar.application;!
var name = app.name;!
var bus = app.bus;!
!
// Listen for messages on the ‘hello’ topic!
bus.on(‘hello’, function(msg) {!
print(name + ‘ got ‘ + msg); !
});!
!
// Start a background thread which publishes to the ‘hello’ topic!
// Background threads do not participate in request processing!
threads.newBackgroundThread(‘background’, ‘hello.js’).start();!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!26
Push Service Example
var avatar = require(‘org/glassfish/avatar’);!
var threads = require('org/glassfish/avatar/threads');!
var bus = avatar.application.bus;!
!
// Register a push service that forwards background messages!
avatar.registerPushService({url: 'push/message'}, function () { !
this.onOpen = function (context) {!
bus.on(’background', function(msg) {!
context.sendMessage({body: msg});!
});!
};!
});!
!
// Create and start a background thread that publishes messages!
threads.newBackgroundThread(‘background’, ‘background.js’).start();!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!27
WebSocket Service Example
// Load avatar module!
var avatar = require(‘org/glassfish/avatar’); !!
// Register service instance!
avatar.registerSocketService({url: ‘websocket/chat’}, !
! ! function() { this.data= {transcript:‘’};!

this.onMessage = function (peer, message) {

this.data.transcript += message;

this.data.transcript += ‘n’;

peer.getContext().sendAll(this.data);!
};!
});!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!28
Model-Store Framework
▪ JavaScript ORM library
▪ Pure JavaScript API that
– Supports relational and non-relational databases
– Integration with other Avatar services
▪ Similar to pure Node.js libraries
– Sequelize, JugglingDB, db
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!29
Model-Store API
Model and Database setup
var Product = avatar.newModel({!
"name": {!
type: "string",!
primary: true!
},!
"price": "number",!
"quantity": "integer"!
});!
var store = avatar.newStore(‘mysql’, {!
host: ‘localhost’,!
port: 3306,!
database: ‘test’,!
username: ‘root’,!
createDb: true,!
dropTables: true!
});!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!30
Model-Store Example
Creating and Storing an Object
// Binds Product model with store!
Product.bind(store);
!
// Insert a new product into the db!
store.connect(function() {
Product.create({
name: 'Widget',!
price: 1.00,
quantity: 2
}, function(err, w1) {
console.log(JSON.stringify(w1));
store.disconnect(function() {
// Done!
});
});
});
▪ Bind Model to Store

▪ Connect to Store
– Creates Product table if
required
– Callback adds product to
table
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!31
Model-Store API
▪ Models can have relationships with other models
– 1:1, 1:n, M,N
▪ Data Stores
– Relational
▪ Testing: Oracle DB, MySQL, Derby (Embedded, Network)
▪ Non-tested: Any other JDBC driver
– Non-relational
▪ Oracle NoSQL, MongoDB (in progress)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!32
Model-Store API
▪ Lots of possibilities
– Configure JPA provider using properties
– Generate JavaScript model from database schema
– User transactions
– 2nd level JPA cache, TopLink Grid
– Oracle RAC Support
– More …
▪ Maintain pure JavaScript API
▪ We’re looking for YOUR feedback!
Opportunities to leverage JPA features
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!33
Avatar Client Framework
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!34
Avatar Client Model
▪ View
– Extensible component views
– Pre-defined Widget Sets: jQuery UI (default), jQuery Mobile, Dijit
– Declarative UI components
▪ Model
– Models (WS, SSE, REST, local) in JavaScript
– Easily connects to Java and JavaScript services
– Model library usable as standalone JavaScript file
▪ Other Highlights
– Familiar syntax in HTML with “data-” tags
– Bidirectional Data binding using EL (Expression Language)
– CSS support
– AMD modules for code partitioning
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!35
Avatar Architecture – Server and Client
Server
Client
REST/WebSocket/SSE
*.html
*.css
*.js
HTP
Database
Data
Notification
JDK 8 / Nashorn
Avatar Compiler
Avatar Runtime
Node Modules
Avatar Modules
Server Runtime (Java EE)
Application
Services
Application Views
= Java framework
= JavaScript framework
= Application code
Avatar.js
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!36
Hello World Example
<script data-model=”local” data-instance="name">!
       var NameModel = function() {!
             this.first = "John";!
             this.last = "Doe";!
             this.clear = function() { this.first = this.last = "”; }; !
};!
</script>!
View
<form>!
<label for="first">First Name</label>!
<input id="first" type="text” data-value="#{name.first}"/>!
<label for=“last">Last Name</label>!
<input id=“last" type="text” data-value="#{name.last}"/>!
Hello #{name.first} #{name.last}!
<button onclick="#{name.clear()}”>Clear</button>!
</form>!
Model
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!37
Chat Example: WebSockets
<script data-model="socket">!
var ChatModel = function() {!
…!
this.sendMsg = function() {!
this.send(this.user + ":" + this.message);!
this.message = "";!
};!
};!
</script>!
!
<script data-type="ChatModel" data-instance="chat”!
data-url=“websocket/chat”>!
</script>!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!38
Summary
▪ Invoke Java code
▪ Multi-threading optimizations
– Share state across threads, JVMs
– Built-in load balancing across threads
▪ Leverage Java EE services
▪ Deploy on existing Java EE infrastructure
– Leverage AppServer features (clustering, lifecycle management)
Server Side JavaScript on the JVM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!39
Avatar Roadmap
WebLogic Runtime
2014 20152013
Project Avatar Launch
(JavaOne, 2013
!GlassFish 4 Runtime
WebLogic 12.1.4
!
Avatar Commercial
Support
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!40
Next Steps
1) Download
https://avatar.java.net/
2) Try it out
!
3) Give us feedback
https://avatar.java.net/mailing.html
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!41
Thanks!
Project Avatar
https://avatar.java.net/
!
Java EE 8 Survey
http://glassfish.org/survey
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!42

More Related Content

What's hot

Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Arun Gupta
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Arun Gupta
 
Java Web Application Security - Utah JUG 2011
Java Web Application Security - Utah JUG 2011Java Web Application Security - Utah JUG 2011
Java Web Application Security - Utah JUG 2011Matt Raible
 
Threads Needles Stacks Heaps - Java edition
Threads Needles Stacks Heaps - Java editionThreads Needles Stacks Heaps - Java edition
Threads Needles Stacks Heaps - Java editionOvidiu Dimulescu
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...Edureka!
 
XML and Web Services with Groovy
XML and Web Services with GroovyXML and Web Services with Groovy
XML and Web Services with GroovyPaul King
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reza Rahman
 
Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Simon Ritter
 
Modularization With Project Jigsaw in JDK 9
Modularization With Project Jigsaw in JDK 9Modularization With Project Jigsaw in JDK 9
Modularization With Project Jigsaw in JDK 9Simon Ritter
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationMarakana Inc.
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future KeynoteSimon Ritter
 
The Hacker's Guide To Session Hijacking
The Hacker's Guide To Session HijackingThe Hacker's Guide To Session Hijacking
The Hacker's Guide To Session HijackingPatrycja Wegrzynowicz
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1James Pearce
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishArun Gupta
 

What's hot (20)

Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
Building HTML5 WebSocket Apps in Java at JavaOne Latin America 2012
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010
 
Java Web Application Security - Utah JUG 2011
Java Web Application Security - Utah JUG 2011Java Web Application Security - Utah JUG 2011
Java Web Application Security - Utah JUG 2011
 
Threads Needles Stacks Heaps - Java edition
Threads Needles Stacks Heaps - Java editionThreads Needles Stacks Heaps - Java edition
Threads Needles Stacks Heaps - Java edition
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...JavaScript Interview Questions and Answers | Full Stack Web Development Train...
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
遇見 Ruby on Rails
遇見 Ruby on Rails遇見 Ruby on Rails
遇見 Ruby on Rails
 
XML and Web Services with Groovy
XML and Web Services with GroovyXML and Web Services with Groovy
XML and Web Services with Groovy
 
01 java intro
01 java intro01 java intro
01 java intro
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 
Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014Oracle Keynote from JMagghreb 2014
Oracle Keynote from JMagghreb 2014
 
Modularization With Project Jigsaw in JDK 9
Modularization With Project Jigsaw in JDK 9Modularization With Project Jigsaw in JDK 9
Modularization With Project Jigsaw in JDK 9
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovation
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
Java: Create The Future Keynote
Java: Create The Future KeynoteJava: Create The Future Keynote
Java: Create The Future Keynote
 
The Hacker's Guide To Session Hijacking
The Hacker's Guide To Session HijackingThe Hacker's Guide To Session Hijacking
The Hacker's Guide To Session Hijacking
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFishJava API for WebSocket 1.0: Java EE 7 and GlassFish
Java API for WebSocket 1.0: Java EE 7 and GlassFish
 

Similar to Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)David Delabassee
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScriptGeertjan Wielenga
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsPavel Bucek
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Marco Antonio Maciel
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Bruno Borges
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8jclingan
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewJosh Padnick
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouDavid Delabassee
 
Oracle JET: Enterprise-Ready JavaScript Toolkit
Oracle JET: Enterprise-Ready JavaScript ToolkitOracle JET: Enterprise-Ready JavaScript Toolkit
Oracle JET: Enterprise-Ready JavaScript ToolkitGeertjan Wielenga
 
Servidores de Aplicação: por que ainda precisamos deles?
Servidores de Aplicação: por que ainda precisamos deles?Servidores de Aplicação: por que ainda precisamos deles?
Servidores de Aplicação: por que ainda precisamos deles?Bruno Borges
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setupsnopteck
 
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaGetting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaCodemotion
 

Similar to Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014 (20)

Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Project Avatar (Lyon JUG & Alpes JUG  - March 2014)Project Avatar (Lyon JUG & Alpes JUG  - March 2014)
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
 
Imworld.ro
Imworld.roImworld.ro
Imworld.ro
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript
 
Slovenian Oracle User Group
Slovenian Oracle User GroupSlovenian Oracle User Group
Slovenian Oracle User Group
 
WebSockets in Enterprise Applications
WebSockets in Enterprise ApplicationsWebSockets in Enterprise Applications
WebSockets in Enterprise Applications
 
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
JavaCro'15 - Everything a Java EE Developer needs to know about the JavaScrip...
 
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
 
Session at Oredev 2016.
Session at Oredev 2016.Session at Oredev 2016.
Session at Oredev 2016.
 
Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7Construindo aplicações com HTML5, WebSockets, e Java EE 7
Construindo aplicações com HTML5, WebSockets, e Java EE 7
 
Java 8
Java 8Java 8
Java 8
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to YouHTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
 
Oracle JET: Enterprise-Ready JavaScript Toolkit
Oracle JET: Enterprise-Ready JavaScript ToolkitOracle JET: Enterprise-Ready JavaScript Toolkit
Oracle JET: Enterprise-Ready JavaScript Toolkit
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
Servidores de Aplicação: por que ainda precisamos deles?
Servidores de Aplicação: por que ainda precisamos deles?Servidores de Aplicação: por que ainda precisamos deles?
Servidores de Aplicação: por que ainda precisamos deles?
 
Jsp Comparison
 Jsp Comparison Jsp Comparison
Jsp Comparison
 
01 overview-and-setup
01 overview-and-setup01 overview-and-setup
01 overview-and-setup
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun GuptaGetting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
Getting Started with WebSocket and Server-Sent Events using Java by Arun Gupta
 

More from David Delabassee

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessDavid Delabassee
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffDavid Delabassee
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 updateDavid Delabassee
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016David Delabassee
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progressDavid Delabassee
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)David Delabassee
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyDavid Delabassee
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontDavid Delabassee
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8David Delabassee
 

More from David Delabassee (20)

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
 
REST in an Async World
REST in an Async WorldREST in an Async World
REST in an Async World
 
JAX-RS 2.1 Reloaded
JAX-RS 2.1 ReloadedJAX-RS 2.1 Reloaded
JAX-RS 2.1 Reloaded
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 update
 
Java EE Next
Java EE NextJava EE Next
Java EE Next
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016
 
HTTP/2 comes to Java
HTTP/2 comes to JavaHTTP/2 comes to Java
HTTP/2 comes to Java
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progress
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web front
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

Server Side JavaScript on the JVM - Project Avatar - QCon London March 2014

  • 1. Project Avatar:
 Server Side JavaScript on the JVM QCon London 2014 ! David Delabassee @delabassee
 Software Evangelist - Oracle
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!2 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!3 "The French and the British are such good enemies that they can't resist being friends." (Peter Ustinov)
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!4
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!5 Agenda ▪ Web Application Architecture Evolution ▪ JavaScript and Node on the JVM ▪ Project Avatar – Advanced JavaScript Services ▪ Avatar Client Framework ▪ Summary
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!6 Evolution of Web Application Architecture A Java EE Perspective ClientServer Presentation ! (Servlet/JSP) EnterpriseConnectivity
 andBusinessLogic Http ▪ Request / Response ▪ Multi-Page Application Browser Java EE / JVM
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!7 Evolution of Web Application Architecture A Java EE Perspective Presentation ! (Servlet/JSP,
 JSF) Connectivity 
 (REST
 SSE) EnterpriseConnectivity
 andBusinessLogic Http REST Java EE / JVM ▪ Multi-Page Application ▪ In-page updates (AJAX) JavaScript Browser ClientServer
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!8 Modern Web Application Architecture A Java EE Perspective Http, REST REST, SSE, WebSockets Presentation ! (Servlet/JSP,
 JSF) Connectivity 
 (WebSocket,
 REST,SSE) EnterpriseConnectivity
 andBusinessLogic Java EE / JVM ▪ Single-page applications ▪ View/Controller in browser ▪ Model on server View Controller JavaScript Browser ClientServer
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!9 Java EE – The Latest in Enterprise Java ENTERPRISE EDITIONDEVELOPER PRODUCTIVITY MEETING 
 ENTERPRISE DEMANDS Java EE 7 ▪ Batch ▪ Concurrency ▪ Simplified JMS ▪ More annotated POJOs ▪ Less boilerplate code ▪ Cohesive integrated 
 platform ▪ WebSockets ▪ JSON ▪ Servlet 3.1 NIO ▪ REST
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!10 Node.js ▪ Server-side JavaScript based on Chrome v8 engine ▪ Created by Ryan Dahl (2009), Open Source ▪ Designed for fast, scalable network applications ▪ Event-driven, non-blocking I/O model ▪ “Melting pot community” – JavaScript, Java, .NET, PHP, … – Very active, with 60,000+ modules Server Side JavaScript
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!11 Node.js Programming Model ▪ Single threaded ▪ Event-loop – Callback model – Non-blocking I/O calls ▪ Heavily parallelized – User code: sequential ▪ Multi-threading is hard – Thousands of concurrent connections – Deal with deadlocks and race conditions ▪ Blocking I/O is bad HTTP Callback Example:
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!12 Node.js Event Loop Single-Threaded
 Event Loop Resource- Intensive Operations Network File System Network Compute Register Callback CompleteOperation Client Requests (Http) Response
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!13 Evolution of Web Application Architecture Mobile-enabling existing services REST/SSE/WebSockets JavaScript ▪ Project-based end-to-end JavaScript ▪ Rapid prototyping & API layer ▪ Leverage backend resources ▪ Aggregate & transform content ▪ Return JSON to browser View Controller JavaScript Browser ClientServer Node
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!14 ClientServer Evolution of Web Application Architecture Mobile-enabling existing services EnterpriseConnectivity
 andBusinessLogic Java EE / JVM JavaScript What if we could run Node
 alongside Java EE in
 the same JVM? View Controller JavaScript Browser REST / SSE/ WebSockets Node
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!15 JavaScript and Node
 on the JVM
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!16 Project Nashorn ▪ ECMAScript 5.1 compliant ▪ Bundled with JDK 8 – Replaces Rhino – Faster (2x – 10x) – More secure ▪ Seamless Java ßà JavaScript interoperability JavaScript on the JVM http://download.java.net/jdk8/docs/technotes/guides/scripting/nashorn/index.html
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!17 Avatar.js ▪ Platform for server side JavaScript applications ▪ Requires Nashorn (JDK 8) ▪ 95% Node compatibility – Use popular packages (Express, async, commander, etc) – Uses same portability libraries as Node.js – Limitation: No Chrome v8 native APIs ▪ Avatar.js Advantages – Leverage Java frameworks, libraries and tools – Security manager Node on the JVM
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!18 Avatar.js = Node + Java ▪ Node Programming Model – Code in JavaScript – Single event loop / thread – Require (import) Node modules ▪ Invoke Java code – Java types and libraries – new java.lang.Thread();! – new com.myorg.MyObj(); Leverage Java, including Threads Java JavaScript java.lang.Thread java.util.SortedSet java.math.BigInteger Node App JVM Process com.myorg.MyObj require (‘async’) postEvent()
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!19 Project Avatar:
 Advanced JavaScript Services
 
 Leveraging Java EE
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!20 Project Avatar ▪ Similar in spirit to Servlets, but focused on REST, WebSocket, Server Sent Event (SSE) endpoints ▪ Use familiar Node.js event-driven programming model and modules ▪ Layers on Avatar.js Node-compatible runtime ▪ Adds integrated enterprise features A Server Side JavaScript Services Framework
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!21 Project Avatar ▪ Multi-threading, lightweight message passing, no mutable shared state ▪ Model Store – Object Relational Mapping ▪ HTTP listener / load-balancer managed by framework ▪ Messaging – JMS on Java EE container Leveraging the JVM and Java EE
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!22 Avatar Architecture - Server Server Database Data Notification JDK 8 / Nashorn Avatar Runtime Node Modules Avatar Modules Server Runtime (Java EE) Application Services = Java framework = JavaScript framework = Application code Avatar.js
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!23 Avatar Services Multi-core, state sharing, data storage Java JVM Process JavaScript Services Services ServicesServices Database Data Notification shared state JSON JSON JSON JSON HTTP Load Balancer
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!24 Shared State ▪ Two Models – MessageBus ▪ Publish/subscribe message passing – Shared State ▪ Simple map API ▪ Application-scoped instance ▪ Session-scoped instance – Named – Leased, with configurable timeout ▪ Provide required serialization, concurrency, and caching Lightweight inter-thread communication
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!25 State Sharing Example var avatar = require(‘org/glassfish/avatar’);! var threads = require(‘org/glassfish/avatar/threads’);! var app = avatar.application;! var name = app.name;! var bus = app.bus;! ! // Listen for messages on the ‘hello’ topic! bus.on(‘hello’, function(msg) {! print(name + ‘ got ‘ + msg); ! });! ! // Start a background thread which publishes to the ‘hello’ topic! // Background threads do not participate in request processing! threads.newBackgroundThread(‘background’, ‘hello.js’).start();!
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!26 Push Service Example var avatar = require(‘org/glassfish/avatar’);! var threads = require('org/glassfish/avatar/threads');! var bus = avatar.application.bus;! ! // Register a push service that forwards background messages! avatar.registerPushService({url: 'push/message'}, function () { ! this.onOpen = function (context) {! bus.on(’background', function(msg) {! context.sendMessage({body: msg});! });! };! });! ! // Create and start a background thread that publishes messages! threads.newBackgroundThread(‘background’, ‘background.js’).start();!
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!27 WebSocket Service Example // Load avatar module! var avatar = require(‘org/glassfish/avatar’); !! // Register service instance! avatar.registerSocketService({url: ‘websocket/chat’}, ! ! ! function() { this.data= {transcript:‘’};!
 this.onMessage = function (peer, message) {
 this.data.transcript += message;
 this.data.transcript += ‘n’;
 peer.getContext().sendAll(this.data);! };! });!
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!28 Model-Store Framework ▪ JavaScript ORM library ▪ Pure JavaScript API that – Supports relational and non-relational databases – Integration with other Avatar services ▪ Similar to pure Node.js libraries – Sequelize, JugglingDB, db
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!29 Model-Store API Model and Database setup var Product = avatar.newModel({! "name": {! type: "string",! primary: true! },! "price": "number",! "quantity": "integer"! });! var store = avatar.newStore(‘mysql’, {! host: ‘localhost’,! port: 3306,! database: ‘test’,! username: ‘root’,! createDb: true,! dropTables: true! });!
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!30 Model-Store Example Creating and Storing an Object // Binds Product model with store! Product.bind(store); ! // Insert a new product into the db! store.connect(function() { Product.create({ name: 'Widget',! price: 1.00, quantity: 2 }, function(err, w1) { console.log(JSON.stringify(w1)); store.disconnect(function() { // Done! }); }); }); ▪ Bind Model to Store
 ▪ Connect to Store – Creates Product table if required – Callback adds product to table
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!31 Model-Store API ▪ Models can have relationships with other models – 1:1, 1:n, M,N ▪ Data Stores – Relational ▪ Testing: Oracle DB, MySQL, Derby (Embedded, Network) ▪ Non-tested: Any other JDBC driver – Non-relational ▪ Oracle NoSQL, MongoDB (in progress)
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!32 Model-Store API ▪ Lots of possibilities – Configure JPA provider using properties – Generate JavaScript model from database schema – User transactions – 2nd level JPA cache, TopLink Grid – Oracle RAC Support – More … ▪ Maintain pure JavaScript API ▪ We’re looking for YOUR feedback! Opportunities to leverage JPA features
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!33 Avatar Client Framework
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!34 Avatar Client Model ▪ View – Extensible component views – Pre-defined Widget Sets: jQuery UI (default), jQuery Mobile, Dijit – Declarative UI components ▪ Model – Models (WS, SSE, REST, local) in JavaScript – Easily connects to Java and JavaScript services – Model library usable as standalone JavaScript file ▪ Other Highlights – Familiar syntax in HTML with “data-” tags – Bidirectional Data binding using EL (Expression Language) – CSS support – AMD modules for code partitioning
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!35 Avatar Architecture – Server and Client Server Client REST/WebSocket/SSE *.html *.css *.js HTP Database Data Notification JDK 8 / Nashorn Avatar Compiler Avatar Runtime Node Modules Avatar Modules Server Runtime (Java EE) Application Services Application Views = Java framework = JavaScript framework = Application code Avatar.js
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!36 Hello World Example <script data-model=”local” data-instance="name">!        var NameModel = function() {!              this.first = "John";!              this.last = "Doe";!              this.clear = function() { this.first = this.last = "”; }; ! };! </script>! View <form>! <label for="first">First Name</label>! <input id="first" type="text” data-value="#{name.first}"/>! <label for=“last">Last Name</label>! <input id=“last" type="text” data-value="#{name.last}"/>! Hello #{name.first} #{name.last}! <button onclick="#{name.clear()}”>Clear</button>! </form>! Model
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!37 Chat Example: WebSockets <script data-model="socket">! var ChatModel = function() {! …! this.sendMsg = function() {! this.send(this.user + ":" + this.message);! this.message = "";! };! };! </script>! ! <script data-type="ChatModel" data-instance="chat”! data-url=“websocket/chat”>! </script>!
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!38 Summary ▪ Invoke Java code ▪ Multi-threading optimizations – Share state across threads, JVMs – Built-in load balancing across threads ▪ Leverage Java EE services ▪ Deploy on existing Java EE infrastructure – Leverage AppServer features (clustering, lifecycle management) Server Side JavaScript on the JVM
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!39 Avatar Roadmap WebLogic Runtime 2014 20152013 Project Avatar Launch (JavaOne, 2013 !GlassFish 4 Runtime WebLogic 12.1.4 ! Avatar Commercial Support
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!40 Next Steps 1) Download https://avatar.java.net/ 2) Try it out ! 3) Give us feedback https://avatar.java.net/mailing.html
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!41 Thanks! Project Avatar https://avatar.java.net/ ! Java EE 8 Survey http://glassfish.org/survey
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.!42