Slide 1

Slide 1 text

Basic method for Java EE Web Profile HASUNUMA Kenji GlassFish Users Group Japan k.hasunuma@coppermine.jp Twitter: @khasunuma

Slide 2

Slide 2 text

Profile?

Slide 3

Slide 3 text

Subset of 
 Java Specification

Slide 4

Slide 4 text

Subset of 
 Java Specification Java SE
 Compact Profile Java EE
 Web Profile

Slide 5

Slide 5 text

Why Web Profile?

Slide 6

Slide 6 text

Java EE 7 Platform • Web Application • Enterprise Application • Web Services • Management and Security • Java EE-related Specs in Java SE

Slide 7

Slide 7 text

Java EE 7 Platform

Slide 8

Slide 8 text

Java EE 7 Web Profile

Slide 9

Slide 9 text

Java EE 7 Web Profile For Web Applications

Slide 10

Slide 10 text

Why Web profile? • Java EE Servers is too large, complex and slow to use quickly • For Web applications, some of Java EE feature is unused • Web container is often powerless for large Web applications

Slide 11

Slide 11 text

Main features • Web application (JSF, MVC [*1] ) • RESTful Web service (JAX-RS) • Persistence and Transaction (JPA/JTA) • Dependency Injection (CDI) *1 : 3rd party framework or MVC (Java EE 8 Draft)

Slide 12

Slide 12 text

Omit from Web profile • Inter-systems interfaces
 e.g. JAX-WS, JMS, JavaMail, JCA • Authentication/Authorization
 e.g. JACC/JAAS, JASPIC • Server management (JSR 77) • J2EE legacy components

Slide 13

Slide 13 text

EJB Notice • Web profile contains EJB Lite; subset of EJB (Full specs.) • Incl. Session Bean (Local/No I/F), JPA/JTA, Async, Timer (Not persist), etc. • Excl. Session Bean (Remote), MDB, JAX-WS, Timer (Persist) etc.

Slide 14

Slide 14 text

EJB Timer (Not persist) @Schedule(..., persistent = false) void polling() { // processing } (By default, the value of 'persistent' is true)

Slide 15

Slide 15 text

History of Web Profile • Introduction as a part of Java EE 6
 (JAX-RS is excluded) • Add JAX-RS, WebSocket, JSON-P to Java EE 7 Web Profile • Add MVC to Java EE 8 Web Profile (by Early Draft)

Slide 16

Slide 16 text

How to use? • Download 'Web Profile'
 e.g. GlassFish, WAS Liberty • Run as 'Web Profile'
 e.g. WildFly, JBoss EAP • Not Compatible
 e.g. WebLogic (Coming soon?)

Slide 17

Slide 17 text

javax javaee-web-api 7.0 provided Maven Dependencies cf. https://search.maven.org/

Slide 18

Slide 18 text

Full Platform vs. Web Profile

Slide 19

Slide 19 text

How small? Size (Installed) Size (Packaged) GlassFish 4.1.1 Full Platform 126 MBytes 104 MBytes GlassFish 4.1.1 Web Profile 75.8 MBytes 57.9 MBytes

Slide 20

Slide 20 text

How fast? Startup time (*) 1 2 3 WildFly 10 Full Platform 4959 ms 5085 ms 5090 ms WildFly 10 Web Profile 3907 ms 4164 ms 3952 ms * Surface Pro 2 (Windows 10 / Core i5 4300U / 4GB RAM)

Slide 21

Slide 21 text

Full vs. Web Profile Full Platform Web Profile Target System Web application Features Complete Restrict Speed Slow Fast Footprint Large Small Security Strict Basic

Slide 22

Slide 22 text

Using Web Profile

Slide 23

Slide 23 text

Case 1 Migration from Tomcat

Slide 24

Slide 24 text

Before Web Profile

Slide 25

Slide 25 text

After Web Profile

Slide 26

Slide 26 text

Case 2 Web application

Slide 27

Slide 27 text

Simple Web application HTML5 HTML5 HTML5 JPA JSF (MVC)

Slide 28

Slide 28 text

Case 3 Real time application

Slide 29

Slide 29 text

Quote Service (Chart) WebSocket WebSocket

Slide 30

Slide 30 text

Real time chat WebSocket WebSocket WebSocket WebSocket

Slide 31

Slide 31 text

Case 4 RESTful Web services

Slide 32

Slide 32 text

RESTful Web services REST REST Ajax JavaFX Browser Mobile App External Systems JPA JAX-RS

Slide 33

Slide 33 text

Case 5 Sending a notify mail

Slide 34

Slide 34 text

Sending a notify mail JavaMail SMTP

Slide 35

Slide 35 text

Sending a notify mail JavaMail SMTP ?

Slide 36

Slide 36 text

How to use JavaMail? • JavaMail is not in Web Profile • But we can use JavaMail as a library of our applications • Other feature that is not in Web Profile can use as library of applications

Slide 37

Slide 37 text

Case 6 Microservices

Slide 38

Slide 38 text

What's Microservice • The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms
 -- Martin Fowler • Spring Boot is a famous technology for implementation of microservices

Slide 39

Slide 39 text

Java EE Microservice • Some technologies are available; Payara Micro, WAS Liberty, 
 WildFly Swarm, kumuluzEE, etc. • They consists of a subset of Java EE API (such a Web Profile) • They also run on Java SE runtime 
 -- Their footprint is so small

Slide 40

Slide 40 text

Conclusion

Slide 41

Slide 41 text

Why needs Web Profile? • Java EE specs. are too large to build Web applications • Some of Java EE specs. are so often unused • We needed the standard that subset of Java EE for Web applications

Slide 42

Slide 42 text

• Development of almost web apps. • In particular case: • Migration from Tomcat • Real time web apps. (WebSocket) • RESTful Web services (JAX-RS) Use case of Web Profile

Slide 43

Slide 43 text

Attentions • Web Profile is NOT for systems but for applications • Web Profile is lightweight, but some important feature is omitted • There is not "Golden Hammer". We'd use the two specs. for purpose

Slide 44

Slide 44 text

Basic method for 
 Java EE Web Profile HASUNUMA Kenji GlassFish Users Group Japan k.hasunuma@coppermine.jp Twitter: @khasunuma