Server-Side Development 2 Rest

Content

  1. Introduction to REST
  2. Elements of REST style
  3. RESTful URLs
  4. Use MVC with REST & RESTful web services

Message Oriented Communication


Message-oriented communication is a way of communicating between processes. Messages, which correspond to events, are the basic units of data delivered. Tanenbaum and Steen classified message-oriented communication according to two factors—synchronous or asynchronous communication, and transient or persistent communication. In synchronous communication, the sender blocks waiting for the receiver to engage in the exchange. Asynchronous communication does not require both the sender and the receiver to execute simultaneously. So, the sender and recipient are loosely-coupled. The amount of time messages are stored determines whether the communication is transient or persistent. Transient communication stores the message only while both partners in the communication are executing. If the next router or receiver is not available, then the message is discarded. Persistent communication, on the other hand, stores the message until the recipient receives it.

Resource Oriented Communication

ROA is considered a RESTful architecture.  As an architectural style that exploits the existing technology and protocols of the Web, including HTTP and XML,  REST (representational state transfer) is defined by Roy Fielding, co-author of the HTTP specification and co-founder of the Apache HTTP server project,

In that ROA concept, resources include not only IT infrastructure elements such as servers, computers and other devices, but also Web pages, scripts and JSP/ASP pages, and other entities such as traffic lights.

REST Architecture style


REST Architectural Constraints. REST stands for Representational State Transfer, a term coined by Roy Fielding in 2000. It is an architecture style for designing loosely coupled applications over HTTP, that is often used in the development of web services.

“Representation” in REST

In REST-speak, a client and server exchange representations of a resource, which reflect its current state or its desired state. Further more , a way for two machines to transfer the state of a resource via representations, is REST, or Representational state transfer .

REST Architectural constraints,

REST stands for Representational State Transfer,which is a term coined by Roy Fielding in 2000. Furthermore it is an architecture style for designing loosely coupled applications over HTTP, which is often used in the development of web services.

The formal REST constraints are ,

  • Client–server architecture.
  • Statelessness.
  • Cacheability.
  • Layered system.
  • Code on demand (optional)
  • Uniform interface.
  • Relationship between URI and HTTP methods.

RESTful API,

A RESTful API is an application program interface (API) which uses HTTP requests to GET, PUT, POST and DELETE data.

Moreover it referred to as a RESTful web service based on representational state transfer (REST) technology, an architectural style and approach to communications often used in web service development.

Furthermore REST technology is generally preferred to the more robust Simple Object Access Protocol (SOAP) technology because REST leverages less bandwidth, making it more suitable for internet usage. Moreover an API for a website is code that allows two software programs to communicate with each another . Moreover the API spells out the proper way for a developer to write a program requesting services from an operating system or other application.

How RESTful API works

A RESTful API breaks down a transaction to create a series of small modules. moreover each module addresses a particular underlying part of the transaction. Even though it can be challenging for developers to design from scratch, this modularity provides developers with a lot of flexibility . Currently, the the most popular ones are models provided by Amazon Simple Storage Service, Cloud Data Management Interface and OpenStack Swift .

Advantages of RESTful Services

REST provides superior performance, particularly through caching for information that’s not altered and not dynamic. Furthermore REST is the protocol used most often for major services such as Yahoo, E bay, Amazon, and even Google. REST is generally faster and uses less bandwidth.

There are created 4 files for hello world JAX-RS example:

  1. Hello.java
  2. web.xml
  3. index.html
  4. HelloWorldClient.java

Annotations in JAX-RS

Media type in JAX-RS

REFERENCES

https://searchmicroservices.techtarget.com/definition/RESTful-API

https://www.javatpoint.com/jax-rs-annotations-example

https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/core/class-use/MediaType.html

Leave a comment