SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
JavaEE6 MyWayJava,
Java, Tomcat, Eclipse EE
PART 1/2- WebComponents
4 dec 2013
Requirements
Soft requirements, go and see
TomEE Appunti Devoxx2012
JavaEE WebApp Components
JavaEE WebApp Files
JavaEE WebApp Release
The process for creating, deploying, and executing a web application can be
summarized as follows:
1. Develop the web component code.
2. Develop the web application deployment descriptor, if necessary.
3. Compile the web application components and helper classes referenced by
the components.
4. Optionally, package the application into a deployable unit.
5. Deploy the application into a web container.
6. Access a URL that references the web application.
TomEE - WebProfile
TomEE
The Web Profile version of TomEE contains
WEB COMPONENT
● JSF - Apache MyFaces
● JSP - Apache Tomcat
● JSTL - Apache Tomcat
● Servlet - Apache Tomcat
JAVABEANS COMPONENT
● CDI - Apache OpenWebBeans
● EJB - Apache OpenEJB
● JPA - Apache OpenJPA
● JTA - Apache Geronimo Transaction
● Javamail - Apache Geronimo JavaMail
● Bean Validation - Apache BVal
TomEE+
TomEE+
The TomEE Plus distribution adds the following:
WEB COMPONENTS
● JAX-RS - Apache CXF
● JAX-WS - Apache CXF
JAVABEANS COMPONENTS
● JMS - Apache ActiveMQ
● Connector - Apache Geronimo Connector
WebClient
Browser but not only...
WebComponents
WebComponents
Java EE web components are either servlets or
pages created using JSP technology (JSP pages)
and/or JavaServer Faces technology.
No JSF please
http://davidwburns.wordpress.com/2012/04/23/why-i-dont-use-java-server-faces-jsf/
One: JSF isn’t easier than standard web programming
Two: At the mercy of the implementation
Three: You’re cut off from the rest of the web community
Four: The web is meant to be stateless
Five: Be honest. Are you just using JSF as a crutch?
Don’t use JSF to avoid learning the web.
HTML5 for the client
Pure HTML5 clients are all we need.
Servlet
Still core and getting better
… more efficient technologies are in JavaEE7
Servlet3.1.
Asynchronous Servlets
/** approccio sincrono (classico) **/
var dato = ottieniDatoDaRemoto(url);
alert(dato);
/** approccio ad eventi (asincrono) **/
ottieniDatoDaRemoto(url, function(dato) {
alert(dato);
}); //la funzione ritorna subito
JavaEE6 Servlet 3.0
Servlet 3.0 allowed asynchronous request processing but only traditional I/O was permitted. This can
restrict scalability of your applications. In a typical application, ServletInputStream is read in a while
loop.
public class TestServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
ServletInputStream input = request.getInputStream();
byte[] b = new byte[1024];
int len = -1;
while ((len = input.read(b)) != -1) {
. . .
}
}
}
JavaEE7 Servlet 3.1
If the incoming data is blocking or streamed slower than the server can read then the server thread is
waiting for that data. The same can happen if the data is written to ServletOutputStream.
This is resolved in Servet 3.1 (JSR 340, released as part Java EE 7) by adding event listeners -
ReadListener and WriteListener interfaces. These are then registered using ServletInputStream.
setReadListener and ServletOutputStream.setWriteListener. The listeners have callback methods that
are invoked when the content is available to be read or can be written without blocking.
Java WebServices
● JAX-WS: addresses advanced QoS requirements commonly occurring in enterprise
computing. When compared to JAX-RS, JAX-WS makes it easier to support the WS-
* set of protocols, which provide standards for security and reliability, among other
things, and interoperate with other WS-* conforming clients and servers.
● JAX-RS: makes it easier to write web applications that apply some or all of the
constraints of the REST style to induce desirable properties in the application, such
as loose coupling (evolving the server is easier without breaking existing clients),
scalability (start small and grow), and architectural simplicity (use off-the-shelf
components, such as proxies or HTTP routers). You would choose to use JAX-RS
for your web application because it is easier for many types of clients to consume
RESTful web services while enabling the server side to evolve and scale. Clients
can choose to consume some or all aspects of the service and mash it up with other
web-based services.
JAX-WS
http://tomee.apache.org/examples-trunk/simple-webservice/README.html
In our testcase we see how to create a client for our Calculator service via the
javax.xml.ws.Service class and leveraging our CalculatorWs endpoint interface.
JAX-WS steps
Official JEE6 tutorial
The basic steps for creating a web service and client are as follows:
1. Code the implementation class.
2. Compile the implementation class.
3. Package the files into a WAR file.
4. Deploy the WAR file. The web service artifacts, which are used to communicate with
clients, are generated by the GlassFish Server during deployment.
5. Code the client class.
6. Use a wsimport Ant task to generate and compile the web service artifacts needed to
connect to the service.
7. Compile the client class.
8. Run the client.
JAX-WS notes
TomEE container is configured and packaged with Apache CXF .
TomEE leave the use od wsimport optional.
Whether or not you use annotations it's important to understand the performance impact they can
have on a server at startup. In order for the server to discover annotations on classes, it must load the
classes, which means that at startup, a server will look through all the classes in WEB-INF/classes and
WEB-INF/lib, looking for annotations. (Per the specification, servers don't have to look outside these
two places.) You can avoid this search when you know you don't have any annotations by specifying a
metadata-complete attribute on the <web-app> root like this:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
version="3.0" metadata-complete="true">
</web-app>
Run a TomEE example
* Create a Dynamic Web Project
* Add web.xml, beans.xml, index.html
* Add Unit4 library
* Add your package
* Create example sources
SOAP WS Manual Testing
RESTFull WebServices
Resource identification through URI: A RESTful web service exposes a set of resources that identify the
targets of the interaction with its clients. Resources are identified by URIs, which provide a global addressing
space for resource and service discovery.
Uniform interface: Resources are manipulated using a fixed set of four create, read, update, delete
operations: PUT, GET, POST, and DELETE. PUT creates a new resource, which can be then deleted by
using DELETE. GET retrieves the current state of a resource in some representation. POST transfers a new
state onto a resource.
Self-descriptive messages: Resources are decoupled from their representation so that their content can be
accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others. Metadata
about the resource is available and used, for example, to control caching, detect transmission errors,
negotiate the appropriate representation format, and perform authentication or access control.
Stateful interactions through hyperlinks: Every interaction with a resource is stateless; that is, request
messages are self-contained. Stateful interactions are based on the concept of explicit state transfer. Several
techniques exist to exchange state, such as URI rewriting, cookies, and hidden form fields. State can be
embedded in response messages to point to valid future states of the interaction.
JAX-RS Code
@Path("/greeting")
public class SimpleRest {
@GET
public String message() {
return "Hi get REST!";
}
@POST
public String lowerCase(final String message) {
return "Hi post REST!".toLowerCase();
}
}
REST WS Manual Testing
JavaBeans Components
JavaBeansComponents
Web components are supported by the services
of a runtime platform called a web container. A
web container provides such services as request
dispatching, security, concurrency, and lifecycle
management. A web container also gives web
components access to such APIs as naming,
transactions, and email.
Enterprise JavaBeans
Enterprise beans are Java EE components that
implement Enterprise JavaBeans (EJB)
technology. Enterprise beans run in the EJB
container. The EJB container provides system-
level services, such as transactions and security,
to its enterprise beans.
To be continued...
Thank you!
Riferimenti
http://docs.oracle.com/javaee/6/tutorial/doc/index.html
http://davidwburns.wordpress.com/2012/04/23/why-i-dont-use-java-server-faces-jsf/
http://www.html.it/pag/32814/introduzione-a-nodejs/
https://blogs.oracle.com/arungupta/entry/non_blocking_i_o_using
http://blog.sortedset.com/step-by-step-web-services-with-tomcat-tomee-apache-cxf-eclipse/
http://www.javacodegeeks.com/2013/08/async-servlet-feature-of-servlet-3.html

Más contenido relacionado

La actualidad más candente

Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsKaml Sah
 
Creating restful api using mule esb
Creating restful api using mule esbCreating restful api using mule esb
Creating restful api using mule esbRaviShankar Mishra
 
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & CountermeasuresWeb Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & CountermeasuresPraetorian
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsBG Java EE Course
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCFAKHRUN NISHA
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esbPraneethchampion
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSCarol McDonald
 
Mule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce InterfaceMule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce Interfacekrishananth
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentationD.Rajesh Kumar
 

La actualidad más candente (19)

Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Servlets lecture1
Servlets lecture1Servlets lecture1
Servlets lecture1
 
J2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - ComponentsJ2EE - JSP-Servlet- Container - Components
J2EE - JSP-Servlet- Container - Components
 
Creating restful api using mule esb
Creating restful api using mule esbCreating restful api using mule esb
Creating restful api using mule esb
 
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & CountermeasuresWeb Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
JDBC in Servlets
JDBC in ServletsJDBC in Servlets
JDBC in Servlets
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Mule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce InterfaceMule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce Interface
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
JDBC
JDBCJDBC
JDBC
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 

Destacado

BDD in DDD
BDD in DDDBDD in DDD
BDD in DDDoehsani
 
BDD & design paradoxes appunti devoxx2012
BDD & design paradoxes   appunti devoxx2012BDD & design paradoxes   appunti devoxx2012
BDD & design paradoxes appunti devoxx2012Nicola Pedot
 
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.Open Campus Tiscali
 
Behaviour Driven Development - Tutta questione di comunicazione
Behaviour Driven Development - Tutta questione di comunicazioneBehaviour Driven Development - Tutta questione di comunicazione
Behaviour Driven Development - Tutta questione di comunicazioneCodemotion
 
Sviluppare software a colpi di test. Introduzione al BDD
Sviluppare software a colpi di test. Introduzione al BDDSviluppare software a colpi di test. Introduzione al BDD
Sviluppare software a colpi di test. Introduzione al BDDOpen Campus Tiscali
 

Destacado (9)

Bdd
BddBdd
Bdd
 
BDD in DDD
BDD in DDDBDD in DDD
BDD in DDD
 
The BDD live show (ITA)
The BDD live show (ITA)The BDD live show (ITA)
The BDD live show (ITA)
 
BDD & design paradoxes appunti devoxx2012
BDD & design paradoxes   appunti devoxx2012BDD & design paradoxes   appunti devoxx2012
BDD & design paradoxes appunti devoxx2012
 
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.
Sviluppare software a colpi di test – II appuntamento: “mani in pasta col BDD.
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
Behaviour Driven Development - Tutta questione di comunicazione
Behaviour Driven Development - Tutta questione di comunicazioneBehaviour Driven Development - Tutta questione di comunicazione
Behaviour Driven Development - Tutta questione di comunicazione
 
Sviluppare software a colpi di test. Introduzione al BDD
Sviluppare software a colpi di test. Introduzione al BDDSviluppare software a colpi di test. Introduzione al BDD
Sviluppare software a colpi di test. Introduzione al BDD
 
dalTDDalBDD
dalTDDalBDDdalTDDalBDD
dalTDDalBDD
 

Similar a JavaEE6 my way

Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache TomcatAuwal Amshi
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and ServletsRaghu nath
 
SERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGSERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGPrabu U
 
JEE Course - The Web Tier
JEE Course - The Web TierJEE Course - The Web Tier
JEE Course - The Web Tierodedns
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course JavaEE Trainers
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06Ankit Dubey
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practicesejjavies
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Mindfire Solutions
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technologyTanmoy Barman
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01raviIITRoorkee
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music storeADEEBANADEEM
 

Similar a JavaEE6 my way (20)

Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 
Jsp and Servlets
Jsp and ServletsJsp and Servlets
Jsp and Servlets
 
SERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMINGSERVER SIDE PROGRAMMING
SERVER SIDE PROGRAMMING
 
JEE Course - The Web Tier
JEE Course - The Web TierJEE Course - The Web Tier
JEE Course - The Web Tier
 
JEE5 New Features
JEE5 New FeaturesJEE5 New Features
JEE5 New Features
 
Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course Introduction to the Servlet / JSP course
Introduction to the Servlet / JSP course
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06
 
Java part 3
Java part  3Java part  3
Java part 3
 
Servlet by Rj
Servlet by RjServlet by Rj
Servlet by Rj
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Servlets and jsp pages best practices
Servlets and jsp pages best practicesServlets and jsp pages best practices
Servlets and jsp pages best practices
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
ASP.NET WEB API Training
ASP.NET WEB API TrainingASP.NET WEB API Training
ASP.NET WEB API Training
 
Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01Anintroductiontojavawebtechnology 090324184240-phpapp01
Anintroductiontojavawebtechnology 090324184240-phpapp01
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Ppt for Online music store
Ppt for Online music storePpt for Online music store
Ppt for Online music store
 

Más de Nicola Pedot

AI, ML e l'anello mancante
AI, ML e l'anello mancanteAI, ML e l'anello mancante
AI, ML e l'anello mancanteNicola Pedot
 
Say No To Dependency Hell
Say No To Dependency Hell Say No To Dependency Hell
Say No To Dependency Hell Nicola Pedot
 
Java al servizio della data science - Java developers' meeting
Java al servizio della data science - Java developers' meetingJava al servizio della data science - Java developers' meeting
Java al servizio della data science - Java developers' meetingNicola Pedot
 
Java 9-10 What's New
Java 9-10 What's NewJava 9-10 What's New
Java 9-10 What's NewNicola Pedot
 
Tom EE appunti devoxx2012
Tom EE   appunti devoxx2012 Tom EE   appunti devoxx2012
Tom EE appunti devoxx2012 Nicola Pedot
 
Presentazione+Android
Presentazione+AndroidPresentazione+Android
Presentazione+AndroidNicola Pedot
 

Más de Nicola Pedot (11)

AI, ML e l'anello mancante
AI, ML e l'anello mancanteAI, ML e l'anello mancante
AI, ML e l'anello mancante
 
Ethic clean
Ethic cleanEthic clean
Ethic clean
 
Say No To Dependency Hell
Say No To Dependency Hell Say No To Dependency Hell
Say No To Dependency Hell
 
Java al servizio della data science - Java developers' meeting
Java al servizio della data science - Java developers' meetingJava al servizio della data science - Java developers' meeting
Java al servizio della data science - Java developers' meeting
 
Jakarta EE 2018
Jakarta EE 2018Jakarta EE 2018
Jakarta EE 2018
 
Lazy Java
Lazy JavaLazy Java
Lazy Java
 
Java 9-10 What's New
Java 9-10 What's NewJava 9-10 What's New
Java 9-10 What's New
 
Tom EE appunti devoxx2012
Tom EE   appunti devoxx2012 Tom EE   appunti devoxx2012
Tom EE appunti devoxx2012
 
Eclipse Svn
Eclipse SvnEclipse Svn
Eclipse Svn
 
Eclipse
EclipseEclipse
Eclipse
 
Presentazione+Android
Presentazione+AndroidPresentazione+Android
Presentazione+Android
 

Último

SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 

Último (20)

SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

JavaEE6 my way

  • 1. JavaEE6 MyWayJava, Java, Tomcat, Eclipse EE PART 1/2- WebComponents 4 dec 2013
  • 2. Requirements Soft requirements, go and see TomEE Appunti Devoxx2012
  • 5. JavaEE WebApp Release The process for creating, deploying, and executing a web application can be summarized as follows: 1. Develop the web component code. 2. Develop the web application deployment descriptor, if necessary. 3. Compile the web application components and helper classes referenced by the components. 4. Optionally, package the application into a deployable unit. 5. Deploy the application into a web container. 6. Access a URL that references the web application.
  • 6. TomEE - WebProfile TomEE The Web Profile version of TomEE contains WEB COMPONENT ● JSF - Apache MyFaces ● JSP - Apache Tomcat ● JSTL - Apache Tomcat ● Servlet - Apache Tomcat JAVABEANS COMPONENT ● CDI - Apache OpenWebBeans ● EJB - Apache OpenEJB ● JPA - Apache OpenJPA ● JTA - Apache Geronimo Transaction ● Javamail - Apache Geronimo JavaMail ● Bean Validation - Apache BVal
  • 7. TomEE+ TomEE+ The TomEE Plus distribution adds the following: WEB COMPONENTS ● JAX-RS - Apache CXF ● JAX-WS - Apache CXF JAVABEANS COMPONENTS ● JMS - Apache ActiveMQ ● Connector - Apache Geronimo Connector
  • 8.
  • 11. WebComponents Java EE web components are either servlets or pages created using JSP technology (JSP pages) and/or JavaServer Faces technology.
  • 12. No JSF please http://davidwburns.wordpress.com/2012/04/23/why-i-dont-use-java-server-faces-jsf/ One: JSF isn’t easier than standard web programming Two: At the mercy of the implementation Three: You’re cut off from the rest of the web community Four: The web is meant to be stateless Five: Be honest. Are you just using JSF as a crutch? Don’t use JSF to avoid learning the web.
  • 13. HTML5 for the client Pure HTML5 clients are all we need.
  • 14. Servlet Still core and getting better … more efficient technologies are in JavaEE7 Servlet3.1.
  • 15. Asynchronous Servlets /** approccio sincrono (classico) **/ var dato = ottieniDatoDaRemoto(url); alert(dato); /** approccio ad eventi (asincrono) **/ ottieniDatoDaRemoto(url, function(dato) { alert(dato); }); //la funzione ritorna subito
  • 16. JavaEE6 Servlet 3.0 Servlet 3.0 allowed asynchronous request processing but only traditional I/O was permitted. This can restrict scalability of your applications. In a typical application, ServletInputStream is read in a while loop. public class TestServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletInputStream input = request.getInputStream(); byte[] b = new byte[1024]; int len = -1; while ((len = input.read(b)) != -1) { . . . } } }
  • 17. JavaEE7 Servlet 3.1 If the incoming data is blocking or streamed slower than the server can read then the server thread is waiting for that data. The same can happen if the data is written to ServletOutputStream. This is resolved in Servet 3.1 (JSR 340, released as part Java EE 7) by adding event listeners - ReadListener and WriteListener interfaces. These are then registered using ServletInputStream. setReadListener and ServletOutputStream.setWriteListener. The listeners have callback methods that are invoked when the content is available to be read or can be written without blocking.
  • 18. Java WebServices ● JAX-WS: addresses advanced QoS requirements commonly occurring in enterprise computing. When compared to JAX-RS, JAX-WS makes it easier to support the WS- * set of protocols, which provide standards for security and reliability, among other things, and interoperate with other WS-* conforming clients and servers. ● JAX-RS: makes it easier to write web applications that apply some or all of the constraints of the REST style to induce desirable properties in the application, such as loose coupling (evolving the server is easier without breaking existing clients), scalability (start small and grow), and architectural simplicity (use off-the-shelf components, such as proxies or HTTP routers). You would choose to use JAX-RS for your web application because it is easier for many types of clients to consume RESTful web services while enabling the server side to evolve and scale. Clients can choose to consume some or all aspects of the service and mash it up with other web-based services.
  • 19. JAX-WS http://tomee.apache.org/examples-trunk/simple-webservice/README.html In our testcase we see how to create a client for our Calculator service via the javax.xml.ws.Service class and leveraging our CalculatorWs endpoint interface.
  • 20. JAX-WS steps Official JEE6 tutorial The basic steps for creating a web service and client are as follows: 1. Code the implementation class. 2. Compile the implementation class. 3. Package the files into a WAR file. 4. Deploy the WAR file. The web service artifacts, which are used to communicate with clients, are generated by the GlassFish Server during deployment. 5. Code the client class. 6. Use a wsimport Ant task to generate and compile the web service artifacts needed to connect to the service. 7. Compile the client class. 8. Run the client.
  • 21. JAX-WS notes TomEE container is configured and packaged with Apache CXF . TomEE leave the use od wsimport optional. Whether or not you use annotations it's important to understand the performance impact they can have on a server at startup. In order for the server to discover annotations on classes, it must load the classes, which means that at startup, a server will look through all the classes in WEB-INF/classes and WEB-INF/lib, looking for annotations. (Per the specification, servers don't have to look outside these two places.) You can avoid this search when you know you don't have any annotations by specifying a metadata-complete attribute on the <web-app> root like this: <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" metadata-complete="true"> </web-app>
  • 22. Run a TomEE example * Create a Dynamic Web Project * Add web.xml, beans.xml, index.html * Add Unit4 library * Add your package * Create example sources
  • 23. SOAP WS Manual Testing
  • 24. RESTFull WebServices Resource identification through URI: A RESTful web service exposes a set of resources that identify the targets of the interaction with its clients. Resources are identified by URIs, which provide a global addressing space for resource and service discovery. Uniform interface: Resources are manipulated using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. PUT creates a new resource, which can be then deleted by using DELETE. GET retrieves the current state of a resource in some representation. POST transfers a new state onto a resource. Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others. Metadata about the resource is available and used, for example, to control caching, detect transmission errors, negotiate the appropriate representation format, and perform authentication or access control. Stateful interactions through hyperlinks: Every interaction with a resource is stateless; that is, request messages are self-contained. Stateful interactions are based on the concept of explicit state transfer. Several techniques exist to exchange state, such as URI rewriting, cookies, and hidden form fields. State can be embedded in response messages to point to valid future states of the interaction.
  • 25. JAX-RS Code @Path("/greeting") public class SimpleRest { @GET public String message() { return "Hi get REST!"; } @POST public String lowerCase(final String message) { return "Hi post REST!".toLowerCase(); } }
  • 26. REST WS Manual Testing
  • 28. JavaBeansComponents Web components are supported by the services of a runtime platform called a web container. A web container provides such services as request dispatching, security, concurrency, and lifecycle management. A web container also gives web components access to such APIs as naming, transactions, and email.
  • 29. Enterprise JavaBeans Enterprise beans are Java EE components that implement Enterprise JavaBeans (EJB) technology. Enterprise beans run in the EJB container. The EJB container provides system- level services, such as transactions and security, to its enterprise beans.