SlideShare a Scribd company logo
1 of 16
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

Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
BG 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-WS
Katrien Verbert
 
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 entities
Oro Inc.
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
Guy Nir
 
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
Bo-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

Rest presentation
Rest  presentationRest  presentation
Rest presentation
srividhyau
 

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

Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
danwrong
 

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

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

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