SlideShare a Scribd company logo
1 of 42
Download to read offline
Sagara	
  Gunathunga	
  
JavaEE	
  and	
  RESTful	
  development	
  
•  RESTfull development
•  Introduction to JavaEE
•  Context and Dependency Injection
•  WSO2 Application Server
2	
  
Agenda	
  
3	
  
	
  	
  REST	
  	
  
REpresentational State Transfer
“An architecture style of networked systems”
4	
  
	
  	
  REST	
  	
  
Let’s take an
example
REpresentational State Transfer
An architecture style of networked systems
Premier
Cooperate
Regular
Customer
Care
Answering
Machine
Regular
Customer
Representative
Premier
Customer
Representative
Cooperate
Customer
Representative
•  Example - Customer care system of a bank
- The bank provides a single telephone number
	
  	
  REST	
  	
  
Premier
Cooperate
Regular
Answering
Machine
Regular
Customer
Representative
Premier
Customer
Representative
Cooperate
Customer
Representative
	
  	
  REST	
  	
  
Answering
Machine
Answering
Machine
•  Example - Customer care system of a bank
- The bank provides a multiple(unique) telephone numbers
Premier
Cooperate
Regular
Customer
Care
Answering
Machine
Regular
Customer
Representative
Premier
Customer
Representative
Cooperate
Customer
Representative
•  Example - Customer care system of a bank
- The bank provides a single telephone number
	
  	
  REST	
  	
  
Not
REST
Premier
Cooperate
Regular
Answering
Machine
Regular
Customer
Representative
Premier
Customer
Representative
Cooperate
Customer
Representative
	
  	
  REST	
  	
  
Answering
Machine
Answering
Machine
•  Example - Customer care system of a bank
- The bank provides a multiple(unique) telephone numbers
REST
Resources	
  
Every	
  disAnguishable	
  enAty	
  is	
  a	
  resource.	
  	
  A	
  resource	
  may	
  be	
  a	
  Web	
  site,	
  an	
  
HTML	
  page,	
  an	
  XML	
  document,	
  a	
  Web	
  service,	
  a	
  physical	
  device,	
  etc.	
  
	
  
	
  
URLs	
  Iden4fy	
  Resources	
  
Every	
  resource	
  is	
  uniquely	
  idenAfied	
  by	
  a	
  URL.	
  	
  	
  
9	
  
	
  	
  REST	
  	
  Fundamentals	
  	
  	
  
10	
  
	
  	
  REST	
  HTTP Request/Response	
  
11	
  
	
  	
  REST	
  HTTP Request/Response	
  
12	
  
HTTP Method CRUD Desc.
POST CREATE Create -
GET RETRIEVE Retrieve Safe,Idempotent,Cacheable
PUT UPDATE Update Idempotent
DELETE DELETE Delete Idempotent
	
  	
  REST	
  HTTP Methods 	
  
13	
  
	
  	
  REST	
  	
  Fundamentals	
  	
  	
  
• Client-Server
• Separation principle
• Components Independent
• Stateless
• Session state on the client
• Visibility, reliability and scalability
• Trade off (network performance, etc.)
• Cacheable
• A response can be cacheable
• Efficiency but reduce reliability
• Layered system
• System scalability
• 
14	
  
JAX-­‐RS	
  –	
  Java	
  API	
  for	
  RESTfull	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  WebServices	
  	
  
•  Annotation driven API
•  Expose annotated Java bean as HTTP based services
•  Implementation may support WADL
•  Define JAVA ó HTTP mapping
•  Number of implementations
•  Apache CXF
•  Apache Wink
•  Jersey
JAX-­‐RS	
  
JAX-RS Annotated Service
@Path("/hello”)
public class HelloWorldService {
@GET
@Path("/{user}")
public String hello(@PathParam("user") String user) {
}
}
16	
  
JAX-­‐WS	
  Annota4ons	
  	
  
•  @Path
•  @GET
•  @PUT
•  @POST
•  @DELETE
•  @Produces
•  @Consumes
•  @PathParam
•  @QueryParam
•  @MatrixParam
•  @HeaderParam
•  @CookieParam
•  @FormParam
•  @DefaultValue
•  @Context
JAX-­‐RS	
  
JAX-RS Annotated Service
@Path("/hello”)
public class HelloWorldService {
@GET
@Consumes("text/plain")
@Produces("text/xml")
@Path("/{user}")
public String hello(@PathParam("user") String user) {
}
}
18	
  
JavaEE	
  
19	
  
JavaEE	
  6	
  	
  
20	
  
JavaEE	
  –	
  Example	
  	
  
Student REST Service Student DatabaseClients
Let’s take an
example
21	
  
JAX-RS service to
accept HTTP calls
JavaEE	
  –	
  Example	
  	
  
@Path("/student”)
public class HelloWorldService {
@GET
@Path(”getall")
@Produces({"application/json”})
public String getAll() {
}
}
22	
  
JavaEE	
  –	
  Example	
  	
  
@Stateful
public class StudentManagerImpl implements StudentManager {
@PersistenceContext(unitName = "rest-jpa”)
private EntityManager entityManager;
public Student getStudent(int index) {
Student student = entityManager.find(Student.class, index);
return student;
}
}
JPA based data
access service
23	
  
JavaEE	
  –	
  Example	
  	
  
How to integrate
JAX-RS service
with JPA DAO
service ?
JAX-RS service
JPA service
24	
  
JavaEE	
  –	
  Example	
  integra4on	
  	
  
@Path("/student”)
public class HelloWorldService {
StudentManager sm;
public HelloWorldService() {
sm = new StudentManagerImpl();
}
@GET
@Path(”getall")
@Produces({"application/json”})
public String getAll() {
}
}
How to integrate
JAX-RS service
with JPA DAO
service ?
Pure JAVA
25	
  
JavaEE	
  –	
  Example	
  integra4on	
  	
  
@Path("/student”)
public class HelloWorldService {
StudentManager sm;
public void setStudentManager (StudentManager sm) { }
public StudentManager setStudentManager () { }
@GET
@Path(”getall")
@Produces({"application/json”})
public String getAll() {
}
}
How to integrate
JAX-RS service
with JPA DAO
service ?
Spring
Framework
26	
  
JavaEE	
  –	
  Example	
  integra4on	
  	
  
@Path("/student”)
public class HelloWorldService {
@Inject
StudentManager sm;
@GET
@Path(”getall")
@Produces({"application/json”})
public String getAll() {
}
}
How to integrate
JAX-RS service
with JPA DAO
service ?
JavaEE
CDI
27	
  
JavaEE	
  –	
  Example	
  integra4on	
  	
  
How to integrate
JAX-RS service
with JPA DAO
service ?JAX-RS service
JPA service
CDI
28	
  
JavaEE	
  –	
  Context	
  and	
  Dependency	
  InjecAon	
  
	
  
@Decorator
@Delegate
@ApplicationScoped
@ConversationScoped
@Dependent
@NormalScope
@RequestScoped
@SessionScoped
@Observes
@Alternative
@Any
@Default
@Disposes
@Model
@New
@Produces
@Specializes
@Stereotype
@Typed
@inject
@Named
@Qualifier
@Scope
@Singleton
29	
  
	
  WSO2	
  Applica4on	
  Server	
  	
  
Yet another
app server ?
•  Tenant-aware data sources
•  Tenant-aware JNDI service
•  Tenant-aware session persistence
•  Tenant-aware user store
•  Tenant-aware authentication and
authorization
•  Tenant-aware Caching
•  Tenant-aware configuration
registry
•  Tenant-aware dashboards
•  Tenant-aware management
console
JavaEE	
  –	
  MulA-­‐tenancy	
  support	
  	
  
	
  
MulAple	
  classloading	
  	
  runAmes	
  	
  
There are four in-built environments
•  Tomcat – Only Tomcat libs are visible (Minimal runtime)
•  Carbon – Tomcat + Carbon libs are visible
•  CXF - Tomcat + CXF + Spring are visible
•  Javaee – JavaEE libs are visible
MulAple	
  classloading	
  	
  runAmes	
  	
  
Ability to create your own custom ‘Classloader Runtime environments’
•  Create directory to place your Jar dependencies
•  Add an entry to webappclassloading-
environments.xml file
e.g. –You can have number of incompatible versions of
Spring frameworks in server level
Server-­‐side	
  JavaScript	
  
•  Develop complete server side application using
Jaggery.js and deploy on Application Server
•  Web Applications
•  RESTfull services
•  WebSocket services
In-­‐built	
  API	
  management	
  	
  
JavaEE	
  Web	
  Profile	
  support	
  	
  
 Web	
  Service	
  development	
  	
  
•  Supported web service development
models
•  JAX –WS ( based on Apache CXF)
•  Apache Axis2
•  Bring your own WS framework
•  Metro, Spring WS
•  Rich dashboard and development tools
•  Try-It tool support
•  Download WS client as maven project
•  Basic statistics
•  Service publish and discovery support
through WSO2 Governance Registry
•  WS – Discovery supported
RESTfull	
  service	
  development	
  	
  
•  Supported RESTfull service
development models.
•  JAX –RS ( based on Apache CXF)
•  Apache Axis2 REST services
•  Jaggery REST services ( Java
Script )
• 
•  Bring your own WS framework
•  Jersey, Rest Easy, Restlet, Spring
•  Rich dashboard and development tools
•  Swagger support.
•  Download REST client as maven
project
•  Basic statistics
Web	
  Socket	
  development	
  	
  
•  Supported WebSocket development models
•  Java API for WebSocket
•  Jaggery Web Sockets ( Java Script )
AcAvity	
  and	
  server	
  monitoring	
  	
  
•  Embedded Monitoring dashboard
•  Request, response, errors, sessions over time
•  Geo info , language, referrals
•  Alerts on thresholds
•  Server and infrastructure health monitoring.
AcAvity	
  and	
  server	
  monitoring	
  	
  
41	
  
References
•  https://github.com/wso2as-developer/javaee-samples
•  https://docs.wso2.com/display/AS521/WSO2+Application+Server
+Documentation
•  http://wso2.com/whitepapers/evaluating-java-ee-application-migration-and-java-
ee-service-migration-to-wso2-application-server/
Contact	
  us	
  !	
  

More Related Content

What's hot

Spring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchSpring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchEberhard Wolff
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleJames Bayer
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppNathalie Steinmetz
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Weblogic performance tuning2
Weblogic performance tuning2Weblogic performance tuning2
Weblogic performance tuning2Aditya Bhuyan
 
Always on in SQL Server 2012
Always on in SQL Server 2012Always on in SQL Server 2012
Always on in SQL Server 2012Fadi Abdulwahab
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构Benjamin Tan
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gMarcelo Ochoa
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & MiddlewaresSantosh Wadghule
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: ServletsFahad Golra
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuseejlp12
 
Sql server 2012 AlwaysOn
Sql server 2012 AlwaysOnSql server 2012 AlwaysOn
Sql server 2012 AlwaysOnWarwick Rudd
 
RESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themRESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themKumaraswamy M
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseMarco Gralike
 

What's hot (20)

Spring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring BatchSpring Web Service, Spring Integration and Spring Batch
Spring Web Service, Spring Integration and Spring Batch
 
WebLogic Deployment Plan Example
WebLogic Deployment Plan ExampleWebLogic Deployment Plan Example
WebLogic Deployment Plan Example
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails App
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Weblogic performance tuning2
Weblogic performance tuning2Weblogic performance tuning2
Weblogic performance tuning2
 
Always on in SQL Server 2012
Always on in SQL Server 2012Always on in SQL Server 2012
Always on in SQL Server 2012
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
 
AlwaysON Basics
AlwaysON BasicsAlwaysON Basics
AlwaysON Basics
 
Native REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11gNative REST Web Services with Oracle 11g
Native REST Web Services with Oracle 11g
 
Rails Request & Middlewares
Rails Request & MiddlewaresRails Request & Middlewares
Rails Request & Middlewares
 
Andrei shakirin rest_cxf
Andrei shakirin rest_cxfAndrei shakirin rest_cxf
Andrei shakirin rest_cxf
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: Servlets
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Weblogic
WeblogicWeblogic
Weblogic
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
Sql server 2012 AlwaysOn
Sql server 2012 AlwaysOnSql server 2012 AlwaysOn
Sql server 2012 AlwaysOn
 
RESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test themRESTful application with JAX-RS and how to expose and test them
RESTful application with JAX-RS and how to expose and test them
 
Weblogic security
Weblogic securityWeblogic security
Weblogic security
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
 
Jersey and JAX-RS
Jersey and JAX-RSJersey and JAX-RS
Jersey and JAX-RS
 

Similar to JavaEE and RESTful development - WSO2 Colombo Meetup

Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy WSO2
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testingrdekleijn
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RSFahad Golra
 
Java Web services
Java Web servicesJava Web services
Java Web servicesvpulec
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
WSO2 Quarterly Technical Update
WSO2 Quarterly Technical UpdateWSO2 Quarterly Technical Update
WSO2 Quarterly Technical UpdateWSO2
 
Soa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesSoa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesVaibhav Khanna
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesLudovic Champenois
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroOndrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroPayara
 

Similar to JavaEE and RESTful development - WSO2 Colombo Meetup (20)

Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy Kick Start your Application Development and Management Strategy
Kick Start your Application Development and Management Strategy
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
 
WSO2 AppDev platform
WSO2 AppDev platformWSO2 AppDev platform
WSO2 AppDev platform
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS MiddlewareOracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
 
WSO2 Quarterly Technical Update
WSO2 Quarterly Technical UpdateWSO2 Quarterly Technical Update
WSO2 Quarterly Technical Update
 
Soa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesSoa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web services
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul services
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
Elastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara MicroElastic and Cloud-ready Applications with Payara Micro
Elastic and Cloud-ready Applications with Payara Micro
 
JAX-RS.next
JAX-RS.nextJAX-RS.next
JAX-RS.next
 

More from Sagara Gunathunga

Microservices Security landscape
Microservices Security landscapeMicroservices Security landscape
Microservices Security landscapeSagara Gunathunga
 
Privacy by Design as a system design strategy - EIC 2019
Privacy by Design as a system design strategy - EIC 2019 Privacy by Design as a system design strategy - EIC 2019
Privacy by Design as a system design strategy - EIC 2019 Sagara Gunathunga
 
Consumer Identity World EU - Five pillars of consumer IAM
Consumer Identity World EU - Five pillars of consumer IAM Consumer Identity World EU - Five pillars of consumer IAM
Consumer Identity World EU - Five pillars of consumer IAM Sagara Gunathunga
 
kicking your enterprise security up a notch with adaptive authentication sa...
kicking your enterprise security up a notch with adaptive authentication   sa...kicking your enterprise security up a notch with adaptive authentication   sa...
kicking your enterprise security up a notch with adaptive authentication sa...Sagara Gunathunga
 
Synergies across APIs and IAM
Synergies across APIs and IAMSynergies across APIs and IAM
Synergies across APIs and IAMSagara Gunathunga
 
GDPR impact on Consumer Identity and Access Management (CIAM)
GDPR impact on Consumer Identity and Access Management (CIAM)GDPR impact on Consumer Identity and Access Management (CIAM)
GDPR impact on Consumer Identity and Access Management (CIAM)Sagara Gunathunga
 
Introduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreIntroduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreSagara Gunathunga
 
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...Building Services with WSO2 Application Server and WSO2 Microservices Framewo...
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...Sagara Gunathunga
 
An Introduction to WSO2 Microservices Framework for Java
An Introduction to WSO2 Microservices Framework for JavaAn Introduction to WSO2 Microservices Framework for Java
An Introduction to WSO2 Microservices Framework for JavaSagara Gunathunga
 
Understanding Microservice Architecture WSO2Con Asia 2016
Understanding Microservice Architecture WSO2Con Asia 2016 Understanding Microservice Architecture WSO2Con Asia 2016
Understanding Microservice Architecture WSO2Con Asia 2016 Sagara Gunathunga
 
Introduction to the all new wso2 governance centre asia 16
Introduction to the all new wso2 governance centre asia 16Introduction to the all new wso2 governance centre asia 16
Introduction to the all new wso2 governance centre asia 16Sagara Gunathunga
 
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case Study
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case StudyBuilding Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case Study
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case StudySagara Gunathunga
 
Introduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreIntroduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreSagara Gunathunga
 
Application Monitoring with WSO2 App Server
Application Monitoring with WSO2 App ServerApplication Monitoring with WSO2 App Server
Application Monitoring with WSO2 App ServerSagara Gunathunga
 
Creating APIs with the WSO2 Platform
Creating APIs with the WSO2 PlatformCreating APIs with the WSO2 Platform
Creating APIs with the WSO2 PlatformSagara Gunathunga
 
Apache contribution-bar camp-colombo
Apache contribution-bar camp-colomboApache contribution-bar camp-colombo
Apache contribution-bar camp-colomboSagara Gunathunga
 

More from Sagara Gunathunga (20)

Microservices Security landscape
Microservices Security landscapeMicroservices Security landscape
Microservices Security landscape
 
Privacy by Design as a system design strategy - EIC 2019
Privacy by Design as a system design strategy - EIC 2019 Privacy by Design as a system design strategy - EIC 2019
Privacy by Design as a system design strategy - EIC 2019
 
Consumer Identity World EU - Five pillars of consumer IAM
Consumer Identity World EU - Five pillars of consumer IAM Consumer Identity World EU - Five pillars of consumer IAM
Consumer Identity World EU - Five pillars of consumer IAM
 
kicking your enterprise security up a notch with adaptive authentication sa...
kicking your enterprise security up a notch with adaptive authentication   sa...kicking your enterprise security up a notch with adaptive authentication   sa...
kicking your enterprise security up a notch with adaptive authentication sa...
 
Synergies across APIs and IAM
Synergies across APIs and IAMSynergies across APIs and IAM
Synergies across APIs and IAM
 
GDPR impact on Consumer Identity and Access Management (CIAM)
GDPR impact on Consumer Identity and Access Management (CIAM)GDPR impact on Consumer Identity and Access Management (CIAM)
GDPR impact on Consumer Identity and Access Management (CIAM)
 
Introduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreIntroduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance Centre
 
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...Building Services with WSO2 Application Server and WSO2 Microservices Framewo...
Building Services with WSO2 Application Server and WSO2 Microservices Framewo...
 
An Introduction to WSO2 Microservices Framework for Java
An Introduction to WSO2 Microservices Framework for JavaAn Introduction to WSO2 Microservices Framework for Java
An Introduction to WSO2 Microservices Framework for Java
 
Understanding Microservice Architecture WSO2Con Asia 2016
Understanding Microservice Architecture WSO2Con Asia 2016 Understanding Microservice Architecture WSO2Con Asia 2016
Understanding Microservice Architecture WSO2Con Asia 2016
 
Introduction to the all new wso2 governance centre asia 16
Introduction to the all new wso2 governance centre asia 16Introduction to the all new wso2 governance centre asia 16
Introduction to the all new wso2 governance centre asia 16
 
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case Study
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case StudyBuilding Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case Study
Building Your Own Store with WSO2 Enterprise Store: The WSO2 Store Case Study
 
Introduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance CentreIntroduction to the All New WSO2 Governance Centre
Introduction to the All New WSO2 Governance Centre
 
Application Monitoring with WSO2 App Server
Application Monitoring with WSO2 App ServerApplication Monitoring with WSO2 App Server
Application Monitoring with WSO2 App Server
 
WSO2 Application Server
WSO2 Application ServerWSO2 Application Server
WSO2 Application Server
 
Creating APIs with the WSO2 Platform
Creating APIs with the WSO2 PlatformCreating APIs with the WSO2 Platform
Creating APIs with the WSO2 Platform
 
Apache contribution-bar camp-colombo
Apache contribution-bar camp-colomboApache contribution-bar camp-colombo
Apache contribution-bar camp-colombo
 
What is new in Axis2 1.7.0
What is new in Axis2 1.7.0 What is new in Axis2 1.7.0
What is new in Axis2 1.7.0
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
 

Recently uploaded

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 

Recently uploaded (20)

KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 

JavaEE and RESTful development - WSO2 Colombo Meetup

  • 1. Sagara  Gunathunga   JavaEE  and  RESTful  development  
  • 2. •  RESTfull development •  Introduction to JavaEE •  Context and Dependency Injection •  WSO2 Application Server 2   Agenda  
  • 3. 3      REST     REpresentational State Transfer “An architecture style of networked systems”
  • 4. 4      REST     Let’s take an example REpresentational State Transfer An architecture style of networked systems
  • 6. Premier Cooperate Regular Answering Machine Regular Customer Representative Premier Customer Representative Cooperate Customer Representative    REST     Answering Machine Answering Machine •  Example - Customer care system of a bank - The bank provides a multiple(unique) telephone numbers
  • 8. Premier Cooperate Regular Answering Machine Regular Customer Representative Premier Customer Representative Cooperate Customer Representative    REST     Answering Machine Answering Machine •  Example - Customer care system of a bank - The bank provides a multiple(unique) telephone numbers REST
  • 9. Resources   Every  disAnguishable  enAty  is  a  resource.    A  resource  may  be  a  Web  site,  an   HTML  page,  an  XML  document,  a  Web  service,  a  physical  device,  etc.       URLs  Iden4fy  Resources   Every  resource  is  uniquely  idenAfied  by  a  URL.       9      REST    Fundamentals      
  • 10. 10      REST  HTTP Request/Response  
  • 11. 11      REST  HTTP Request/Response  
  • 12. 12   HTTP Method CRUD Desc. POST CREATE Create - GET RETRIEVE Retrieve Safe,Idempotent,Cacheable PUT UPDATE Update Idempotent DELETE DELETE Delete Idempotent    REST  HTTP Methods  
  • 13. 13      REST    Fundamentals       • Client-Server • Separation principle • Components Independent • Stateless • Session state on the client • Visibility, reliability and scalability • Trade off (network performance, etc.) • Cacheable • A response can be cacheable • Efficiency but reduce reliability • Layered system • System scalability • 
  • 14. 14   JAX-­‐RS  –  Java  API  for  RESTfull                                                            WebServices     •  Annotation driven API •  Expose annotated Java bean as HTTP based services •  Implementation may support WADL •  Define JAVA ó HTTP mapping •  Number of implementations •  Apache CXF •  Apache Wink •  Jersey
  • 15. JAX-­‐RS   JAX-RS Annotated Service @Path("/hello”) public class HelloWorldService { @GET @Path("/{user}") public String hello(@PathParam("user") String user) { } }
  • 16. 16   JAX-­‐WS  Annota4ons     •  @Path •  @GET •  @PUT •  @POST •  @DELETE •  @Produces •  @Consumes •  @PathParam •  @QueryParam •  @MatrixParam •  @HeaderParam •  @CookieParam •  @FormParam •  @DefaultValue •  @Context
  • 17. JAX-­‐RS   JAX-RS Annotated Service @Path("/hello”) public class HelloWorldService { @GET @Consumes("text/plain") @Produces("text/xml") @Path("/{user}") public String hello(@PathParam("user") String user) { } }
  • 20. 20   JavaEE  –  Example     Student REST Service Student DatabaseClients Let’s take an example
  • 21. 21   JAX-RS service to accept HTTP calls JavaEE  –  Example     @Path("/student”) public class HelloWorldService { @GET @Path(”getall") @Produces({"application/json”}) public String getAll() { } }
  • 22. 22   JavaEE  –  Example     @Stateful public class StudentManagerImpl implements StudentManager { @PersistenceContext(unitName = "rest-jpa”) private EntityManager entityManager; public Student getStudent(int index) { Student student = entityManager.find(Student.class, index); return student; } } JPA based data access service
  • 23. 23   JavaEE  –  Example     How to integrate JAX-RS service with JPA DAO service ? JAX-RS service JPA service
  • 24. 24   JavaEE  –  Example  integra4on     @Path("/student”) public class HelloWorldService { StudentManager sm; public HelloWorldService() { sm = new StudentManagerImpl(); } @GET @Path(”getall") @Produces({"application/json”}) public String getAll() { } } How to integrate JAX-RS service with JPA DAO service ? Pure JAVA
  • 25. 25   JavaEE  –  Example  integra4on     @Path("/student”) public class HelloWorldService { StudentManager sm; public void setStudentManager (StudentManager sm) { } public StudentManager setStudentManager () { } @GET @Path(”getall") @Produces({"application/json”}) public String getAll() { } } How to integrate JAX-RS service with JPA DAO service ? Spring Framework
  • 26. 26   JavaEE  –  Example  integra4on     @Path("/student”) public class HelloWorldService { @Inject StudentManager sm; @GET @Path(”getall") @Produces({"application/json”}) public String getAll() { } } How to integrate JAX-RS service with JPA DAO service ? JavaEE CDI
  • 27. 27   JavaEE  –  Example  integra4on     How to integrate JAX-RS service with JPA DAO service ?JAX-RS service JPA service CDI
  • 28. 28   JavaEE  –  Context  and  Dependency  InjecAon     @Decorator @Delegate @ApplicationScoped @ConversationScoped @Dependent @NormalScope @RequestScoped @SessionScoped @Observes @Alternative @Any @Default @Disposes @Model @New @Produces @Specializes @Stereotype @Typed @inject @Named @Qualifier @Scope @Singleton
  • 29. 29    WSO2  Applica4on  Server     Yet another app server ?
  • 30. •  Tenant-aware data sources •  Tenant-aware JNDI service •  Tenant-aware session persistence •  Tenant-aware user store •  Tenant-aware authentication and authorization •  Tenant-aware Caching •  Tenant-aware configuration registry •  Tenant-aware dashboards •  Tenant-aware management console JavaEE  –  MulA-­‐tenancy  support      
  • 31. MulAple  classloading    runAmes     There are four in-built environments •  Tomcat – Only Tomcat libs are visible (Minimal runtime) •  Carbon – Tomcat + Carbon libs are visible •  CXF - Tomcat + CXF + Spring are visible •  Javaee – JavaEE libs are visible
  • 32. MulAple  classloading    runAmes     Ability to create your own custom ‘Classloader Runtime environments’ •  Create directory to place your Jar dependencies •  Add an entry to webappclassloading- environments.xml file e.g. –You can have number of incompatible versions of Spring frameworks in server level
  • 33. Server-­‐side  JavaScript   •  Develop complete server side application using Jaggery.js and deploy on Application Server •  Web Applications •  RESTfull services •  WebSocket services
  • 35. JavaEE  Web  Profile  support    
  • 36.  Web  Service  development     •  Supported web service development models •  JAX –WS ( based on Apache CXF) •  Apache Axis2 •  Bring your own WS framework •  Metro, Spring WS •  Rich dashboard and development tools •  Try-It tool support •  Download WS client as maven project •  Basic statistics •  Service publish and discovery support through WSO2 Governance Registry •  WS – Discovery supported
  • 37. RESTfull  service  development     •  Supported RESTfull service development models. •  JAX –RS ( based on Apache CXF) •  Apache Axis2 REST services •  Jaggery REST services ( Java Script ) •  •  Bring your own WS framework •  Jersey, Rest Easy, Restlet, Spring •  Rich dashboard and development tools •  Swagger support. •  Download REST client as maven project •  Basic statistics
  • 38. Web  Socket  development     •  Supported WebSocket development models •  Java API for WebSocket •  Jaggery Web Sockets ( Java Script )
  • 39. AcAvity  and  server  monitoring     •  Embedded Monitoring dashboard •  Request, response, errors, sessions over time •  Geo info , language, referrals •  Alerts on thresholds •  Server and infrastructure health monitoring.
  • 40. AcAvity  and  server  monitoring    
  • 41. 41   References •  https://github.com/wso2as-developer/javaee-samples •  https://docs.wso2.com/display/AS521/WSO2+Application+Server +Documentation •  http://wso2.com/whitepapers/evaluating-java-ee-application-migration-and-java- ee-service-migration-to-wso2-application-server/