11

Click here to load reader

Rest ws

Embed Size (px)

Citation preview

Page 1: Rest ws

1

REST Web Service

By: Sari Meriem

UNIVERSITY of MOHAMED CHERIF MESAADIASOUK-AHRAS

Departement of Math & Computer Science

Presentation About:

Page 2: Rest ws

Reminder

2Meriem Sari Service Web 2 eme AM GL

Stands for: Representational State Transfer.

Is an architectural style.

Introduced first in 2000 then standardized in 2008.

Everything in REST is considered as a resource.

Every resource is identified by an URI.

Page 3: Rest ws

Reminder

3

Resources are handled using POST, GET, PUT, DELETE operations which are similar to Create, Read, update and Delete(CRUD) operations.

It uses uniform interfaces.

A RESTful Web service is a Web service implemented using HTTP and the principles of REST.

Meriem Sari Service Web 2 eme AM GL

Page 4: Rest ws

Requirements

4

Eclipse luna.

jersey-archive-1.18.

Meriem Sari Service Web 2 eme AM GL

Page 5: Rest ws

Example

5Meriem Sari Service Web 2 eme AM GL

Page 6: Rest ws

Example

6

Copy all jar files from the Jersey zip into WEB-INF/lib folder.

Select build path in your project and add the same jars in your build path.

Create package called com.javatutorialscorner.rest.ws.

Create following class inside package com.javatutorialscorner.rest.ws

RestHelloWorld .java

Meriem Sari Service Web 2 eme AM GL

Page 7: Rest ws

Example

7Meriem Sari Service Web 2 eme AM GL

Page 8: Rest ws

Example

8

We get the following structure for our program

Meriem Sari Service Web 2 eme AM GL

Page 9: Rest ws

Example

9

We configure the « web.xml » file to have the following code

Meriem Sari Service Web 2 eme AM GL

Page 10: Rest ws

Example

10

We create the client class under the same package containing the following code:

Meriem Sari Service Web 2 eme AM GL

Page 11: Rest ws

Example

11

We run our client side and we get the following results either in consol or in our web browser:

Meriem Sari Service Web 2 eme AM GL