SlideShare a Scribd company logo
Group15 Rest
    Yuan Gao
    Ning Ma
     Bin Cai
Overview
Introduction

Technologies and toolkits

Architecture

Implementation & Security

Deploy & Test

Analysis and evaluation
Introduction

RESTful Web Services is different from SOAP-
style services

using HTTP GET PUT POST DELETE

Unique URI to describe Resource
Introduction
Client

3 Services:
TravelAgent, Flight, Hotel

Resources:
/flight
/hotel
/booking
/query
Technologies and
     Toolkits

AJAX: send request and receive response

XML: store and transmit data

JAX-RS (JSR 311): Java API for RESTful Web
Services
Technologies and
     Toolkits

Maven: project management

Jersey: JAX-RS Reference Implementation for
building RESTful Web services

Grizzly: Web application container
Architecture
  Diagram
Implementation
     define classes:
import                                      import
javax.xml.bind.annotation.XmlRootElement;   javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement                             @XmlRootElement
public class Flight {                       public class Hotel {
!                                           !   private int Id;
!   private int flightNo;                    !   private String Name;
!   private String from;                    !   private int price;
!   private String to;                      !   private String address;
!   private int departTime;                 !   public Hotel() {}
!   private int arriveTime;                 ...
!   private int price;
!   public Flight() {}
...
     TravelAgent, FlightResource, HotelResource...etc...
Implementation

Jersey API annotation:
@Path
@GET
@POST
@Produces
...

Let’s look at some pieces of code as example:
Some code...
@Path("/flight")
@Produces("application/xml")
public class FlightResource {
!
!   public TreeMap<Integer, Flight> flightMap = new TreeMap<Integer, Flight>();

    ...

!    @GET
!    public List<Flight> getFlights() {
!      List<Flight> flights = new ArrayList<Flight>();
!      flights.addAll(getFlightMap().values());
!      return flights;
!    }
Some code...

...

      @GET
!     @Path("{flightNo}")
!     public Flight getFlight(@PathParam("flightNo") int cId) {
!       return getFlightMap().get(cId);
!     }
...
Security

HTTPS: use class HTTPSProperties to set
javax.net.ssl.HostnameVerifier and
javax.net.ssl.SSLContext

@Context SecurityContext customer

if (customer.isUserInRole("user") {
           return new Flight();
        } else {
           return “please provide effective customer”;
      }
Deploy
<web-app>
 <servlet>
 <servlet-name>Jersey Web Application</servlet-name>
 <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
  <init-param>
   <param-name>com.sun.jersey.config.property.packages</param-name>
   <param-value>uk.ac.soton.ecs.comp6017</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
 <servlet-name>Jersey Web Application</servlet-name>
 <url-pattern>/*</url-pattern>
 </servlet-mapping>
</web-app>
Test
          use Jersey client api to set up test case

try {
   ! !    System.out.println("==> Test 1: Get all flight ");
      !
   ! !    ClientConfig config = new DefaultClientConfig();
   ! !    Client client = Client.create(config);
   ! !    client.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true);
   ! !    WebResource service = client.resource("http://localhost:8080/");

System.out.println(service.path("rest2011").path("travelagent").type(MediaType.APPLICATION_FORM_
URLENCODED).get(String.class));
      System.out.println("n");
  ! }


...
Analysis and
       evaluation

Understanding REST architecture

Use toolkits to implement scenario

Challenges

Work as a team
Thank you!

More Related Content

What's hot

Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
zeeshanhanif
 
Slim Framework
Slim FrameworkSlim Framework
Slim Framework
Pramod Raghav
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
Carol McDonald
 
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - WisemblySymfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Guillaume POTIER
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
Yakov Fain
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedBG Java EE Course
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WSKatrien Verbert
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
Eliran Eliassy
 
JAX-WS Basics
JAX-WS BasicsJAX-WS Basics
JAX-WS Basics
Wes Williams
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Oro Inc.
 
Working with oro crm entities
Working with oro crm entitiesWorking with oro crm entities
Working with oro crm entitiesOro Inc.
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015
Oro Inc.
 
Angular genericforms2
Angular genericforms2Angular genericforms2
Angular genericforms2
Eliran Eliassy
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
Oro Inc.
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
Visual Engineering
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVCGuy Nir
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
Peter R. Egli
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
Java Success Point
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkBo-Yi Wu
 

What's hot (20)

Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
 
Slim Framework
Slim FrameworkSlim Framework
Slim Framework
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - WisemblySymfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
JAX-WS Basics
JAX-WS BasicsJAX-WS Basics
JAX-WS Basics
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
Working with oro crm entities
Working with oro crm entitiesWorking with oro crm entities
Working with oro crm entities
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015
 
Angular genericforms2
Angular genericforms2Angular genericforms2
Angular genericforms2
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
 
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
 
RESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP FrameworkRESTful API Design & Implementation with CodeIgniter PHP Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
 

Viewers also liked

S: a Scripting Language for High-Performance RESTful Web Services
S: a Scripting Language for High-Performance RESTful Web ServicesS: a Scripting Language for High-Performance RESTful Web Services
S: a Scripting Language for High-Performance RESTful Web Services
Achille Peternier
 
Servicii Web prin REST
Servicii Web prin RESTServicii Web prin REST
Servicii Web prin REST
Sabin Buraga
 
Rest application
Rest applicationRest application
Rest application
Illia Seleznov
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
Rest presentation
Rest  presentationRest  presentation
Rest presentationsrividhyau
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
Alexandros Marinos
 
Criando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSONCriando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSON
Marcio Junior Vieira
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
Christopher Bartling
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
Stormpath
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
Robert MacLean
 

Viewers also liked (11)

S: a Scripting Language for High-Performance RESTful Web Services
S: a Scripting Language for High-Performance RESTful Web ServicesS: a Scripting Language for High-Performance RESTful Web Services
S: a Scripting Language for High-Performance RESTful Web Services
 
Servicii Web prin REST
Servicii Web prin RESTServicii Web prin REST
Servicii Web prin REST
 
Rest application
Rest applicationRest application
Rest application
 
Implementation advantages of rest
Implementation advantages of restImplementation advantages of rest
Implementation advantages of rest
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Criando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSONCriando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSON
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 

Similar to Restful Web Service

Node.js server-side rendering
Node.js server-side renderingNode.js server-side rendering
Node.js server-side rendering
The Software House
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
Amazon Web Services
 
Test-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) serviceTest-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
Jeroen Reijn
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API RESTWeb2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Nicolas Faugout
 
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileJavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
Loiane Groner
 
Api
ApiApi
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
Ted Husted
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
Ted Husted
 
The battle of Protractor and Cypress - RunIT Conference 2019
The battle of Protractor and Cypress - RunIT Conference 2019The battle of Protractor and Cypress - RunIT Conference 2019
The battle of Protractor and Cypress - RunIT Conference 2019
Ludmila Nesvitiy
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
James Titcumb
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
Bo-Yi Wu
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
Carol McDonald
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
名辰 洪
 
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)danwrong
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
Ngoc Dao
 

Similar to Restful Web Service (20)

Node.js server-side rendering
Node.js server-side renderingNode.js server-side rendering
Node.js server-side rendering
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
 
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
AWS re:Invent 2016: Chalice: A Serverless Microframework for Python (DEV308)
 
Test-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) serviceTest-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++
 
Web2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API RESTWeb2Day 2017 - Concilier DomainDriveDesign et API REST
Web2Day 2017 - Concilier DomainDriveDesign et API REST
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileJavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
 
Api
ApiApi
Api
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
The battle of Protractor and Cypress - RunIT Conference 2019
The battle of Protractor and Cypress - RunIT Conference 2019The battle of Protractor and Cypress - RunIT Conference 2019
The battle of Protractor and Cypress - RunIT Conference 2019
 
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
 
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 

Recently uploaded

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 

Recently uploaded (20)

Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 

Restful Web Service

  • 1. Group15 Rest Yuan Gao Ning Ma Bin Cai
  • 2. Overview Introduction Technologies and toolkits Architecture Implementation & Security Deploy & Test Analysis and evaluation
  • 3. Introduction RESTful Web Services is different from SOAP- style services using HTTP GET PUT POST DELETE Unique URI to describe Resource
  • 4. Introduction Client 3 Services: TravelAgent, Flight, Hotel Resources: /flight /hotel /booking /query
  • 5. Technologies and Toolkits AJAX: send request and receive response XML: store and transmit data JAX-RS (JSR 311): Java API for RESTful Web Services
  • 6. Technologies and Toolkits Maven: project management Jersey: JAX-RS Reference Implementation for building RESTful Web services Grizzly: Web application container
  • 8. Implementation define classes: import import javax.xml.bind.annotation.XmlRootElement; javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @XmlRootElement public class Flight { public class Hotel { ! ! private int Id; ! private int flightNo; ! private String Name; ! private String from; ! private int price; ! private String to; ! private String address; ! private int departTime; ! public Hotel() {} ! private int arriveTime; ... ! private int price; ! public Flight() {} ... TravelAgent, FlightResource, HotelResource...etc...
  • 10. Some code... @Path("/flight") @Produces("application/xml") public class FlightResource { ! ! public TreeMap<Integer, Flight> flightMap = new TreeMap<Integer, Flight>(); ... ! @GET ! public List<Flight> getFlights() { ! List<Flight> flights = new ArrayList<Flight>(); ! flights.addAll(getFlightMap().values()); ! return flights; ! }
  • 11. Some code... ... @GET ! @Path("{flightNo}") ! public Flight getFlight(@PathParam("flightNo") int cId) { ! return getFlightMap().get(cId); ! } ...
  • 12. Security HTTPS: use class HTTPSProperties to set javax.net.ssl.HostnameVerifier and javax.net.ssl.SSLContext @Context SecurityContext customer if (customer.isUserInRole("user") {    return new Flight();    } else {    return “please provide effective customer”;    }
  • 13. Deploy <web-app> <servlet> <servlet-name>Jersey Web Application</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>uk.ac.soton.ecs.comp6017</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Jersey Web Application</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
  • 14. Test use Jersey client api to set up test case try { ! ! System.out.println("==> Test 1: Get all flight "); ! ! ! ClientConfig config = new DefaultClientConfig(); ! ! Client client = Client.create(config); ! ! client.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, true); ! ! WebResource service = client.resource("http://localhost:8080/"); System.out.println(service.path("rest2011").path("travelagent").type(MediaType.APPLICATION_FORM_ URLENCODED).get(String.class)); System.out.println("n"); ! } ...
  • 15. Analysis and evaluation Understanding REST architecture Use toolkits to implement scenario Challenges Work as a team

Editor's Notes

  1. Good afternoon ladies and gentlemen. We appreciate the opportunity to be with you. This is Cai bin, the leader of our group, this is Ma ning and I am Gao yuan. The topic of our group is REST.\n
  2. Basically, we have divided our presentation into six parts. We will start by an introduction of the project and the technologies and toolkits which should be used in our project. Next, we will discuss its implementation, security, deploy and test. And to finish off, we will analyse and evaluate our project.\n
  3. REST is short for Representational State Transfer, which is a way of design and development for web applications. It is different from soap style services. RESTful web services use HTTP protocol to send and receive messages. In the rest, all the things are abstracted as resources and each resource has a unique URI.\n
  4. Our project consists of one client, three services and some resources. The client of our project is used ajax and the three services are travel agent, flight and hotel. We define different URLs to mark different resources such as flight, hotel, booking and query.\n
  5. Now, let&amp;#x2019;s move on to the next part of our presentation: the technologies and toolkits. We apply three main technologies to realize our project: ajax and xml and jax-rs. Ajax is used to send request and receive reponse and xml is used to store and transmit data. Jax-rs is a java application for restful web services.\n
  6. We also use three toolkits to complete our project: Maven, Jersey and Grizzly. Maven is a project management which is to manage the whole project. Jersey is a jax-rs reference implementation for building restful web services which provides API as an interface. Grizzly is a web application container.\n
  7. This is the architecture diagram of our project. We have already explained it before. So we skip this slide.\n
  8. Hello, everyone. I will step into the implementation part of our presentation now. &amp;#xA0;Because we are going to implement three services which are travelagent, flight and hotel, we define several classes at first. For example, we use flgiht class to define a flight and hotel class to define hotel. &amp;#xA0;As you can see from the code, we use XMLRootElement annotation to declare the data format of XML and we also add some attributes to the entities. Other classes, such as TravelAgent, FlightResource, HotelResource, are set up to execute requested command and return response.\n
  9. We use Jersey as our toolkit. Because it provide JAX-RS implementation APIs which are easy to use. The annotations which can be used as interface. The Path annotation will define a url path where the resource is located. GET and POST annotation will receive HTTP get or post request and execute the code blew. Produces annotation define the &amp;#xA0;returned data format. There are also other annotations that can be used. Now let&amp;#x2019;s look at some pieces of code as example.\n
  10. This is some code in FlightResource class. We use @path(&amp;#x201C;/flight&amp;#x201D;) to define the flight resource as slash flight and @Produces(&quot;application/xml&quot;) to declare the returned data format is XML. We use TreeMap to store the flight information. When the service receive a get request, the code blew @GET will execute and return the all flights.\n
  11. When the service receive a get request with a specific flightNo, this code will execute and return the requested flight information. The PathParam annotation will get the value of flightNo and pass to cId. Other annotations include QueryParam @Context and so on.\n
  12. Security is really a problem in restful web services, as WS-security is not suitable for rest. Fortunately, we can use HTTPS to enhance the basic http authentication. HTTPS can ensure the request form and return message to the right customer. We use class HTTPSProperties to set up these two packages. For authentication, we use @Context annotation to receive user identity and use these code to verify it.\n
  13. what we create is a web application which will be hosted on a server. We use grizzly as the web container. This is the code in web.xml which config the deployment of our application. The red lines define the parameters which will deploy the package to the servlet\n
  14. For test, we used Jersey client API to set up our test cases. You can see from the code, which is a sample of test case. In this test, the client will send a get request to the travelagent which &amp;#xA0;will return options of available flights and hotels.\n
  15. Hi, everyone! I will finish this presentation with the last part, which is the analysis and evaluation of our project. Before we start this coursework, we have little experience of neither web service nor rest style. So we spend some time to understand the conception of rest architecture. This is a fundamental process of studying by ourselves. Until now I think we have already had a good understanding of restful web services. After we started, we compared some toolkits such as CXF, Axis2 and so on, while we chose jersey as the source community finally. Because Jersey provides complete Java APIs for restful web services which are easy to use and implement.\n\nWe also came across some challenges. When we were going to implement security in our project, we found it is difficult to use WS-security in restful web service and other methods maybe not suitable for our scenario and Jersey is lack of the security APIs to use. So we use transport layer security which is HTTPs instead of application layer security. For test, we cannot write regular unit test case and we had to choose using jersey client to test our project.\n\nThe last point is that we always work as a team. We discuss and think about the way to implement our project together and share the gains with others. As a member of this group, I developed the travel agent service, Bin developed flight service and Test function, and Yuan implement hotel service and security. We did really hard work to complete our work. So I hope everyone can enjoy our project and this presentation.\nThank you!\nAny question?\n
  16. Thank you!\nAny questions?\n