Introduction To RESTful Web Services - SpringPeople

12
© SpringPeople Software Private Limited, All Rights Reserved. © SpringPeople Software Private Limited, All Rights Reserved. Introduction to RESTful Web Services

Transcript of Introduction To RESTful Web Services - SpringPeople

© SpringPeople Software Private Limited, All Rights Reserved. © SpringPeople Software Private Limited, All Rights Reserved.

Introduction to RESTful Web Services

© SpringPeople Software Private Limited, All Rights Reserved.

What are RESTful Web Services?

•RESTful web services are built to work best on the Web.

•Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web.

© SpringPeople Software Private Limited, All Rights Reserved.

What makes RESTful applications so simple, lightweight, and fast?

•Resource identification through URI

•Uniform interface

•Self-descriptive messages

•Stateful interactions through hyperlinks

© SpringPeople Software Private Limited, All Rights Reserved.

© SpringPeople Software Private Limited, All Rights Reserved.

Mapping HTTP Methods to Operations Performed

HTTP Method Operations Performed

GET Get a resource

POST Create a resource and other operations, as it has no defined semantics

PUT Create or update a resource

DELETE Delete a resource

© SpringPeople Software Private Limited, All Rights Reserved.

Common MIME types used by RESTful services

MIME-Type Content-Type

JSON application/json

XML application/xml

XHTML application/xhtml+xml

© SpringPeople Software Private Limited, All Rights Reserved.

Creating a RESTful Resource Class

• Root resource classes are POJOs (Plain Old Java Objects) that are either annotated with@Path or have at least one method annotated with@Path or a request method designator such as @GET, @PUT, @POST, or @DELETE. Resource methods are methods of a resource class annotated with a request method designator. This section describes how to use Jersey to annotate Java objects to create RESTful web services.

© SpringPeople Software Private Limited, All Rights Reserved.

The Storage-Service Application

• The Storage-Service sample application demonstrates a simple, in-memory, web storage service and test code using the Jersey client API. The web storage service enables clients to create and delete containers. Containers are used to create, read, update, and delete items of arbitrary content, and to search for items containing certain content. A container can be thought of as a hash map of items.

© SpringPeople Software Private Limited, All Rights Reserved.

RESTful Webservice Best Practices

• Provide a distinct URI for each resource you wish to expose.

• Use nouns in your URIs, they highlight the fact that resources are things and not actions.

• Methods that map to GET should not change any data.

• Methods that map to POST should change the data.

• Make your service stateless.

© SpringPeople Software Private Limited, All Rights Reserved.

How you can master RESTful Web Services?

Become an expert in 3 days.

World class RESTful Web Services training by the industry experts.

More Details

© SpringPeople Software Private Limited, All Rights Reserved.

Suggested Audience & Other Details

• Prerequisites: All attendees must be experienced Java developers with a solid, hands-on grasp of object-oriented principles. Prior Java EE development experience is recommended but not required.

• Suggested Audience: – Developers

– Architects

• Duration – 3 Days

Syllabus

© SpringPeople Software Private Limited, All Rights Reserved.

For further info/assistance contact

[email protected]

+91 80 656 79700

www.springpeople.com

Our Partners