RESTful Architecture

RESTful Architecture_第1张图片

Simply put

In the realm of web applications, REST (Representational State Transfer) architecture has emerged as a cornerstone for designing scalable, maintainable, and performant systems. This architectural style, introduced by Roy Fielding in his doctoral dissertation, provides a set of guiding principles that help developers build robust web services.

The Essence of RESTful Architecture

At its core, REST is an architectural style that emphasizes scalability, performance, and reliability in the development of web services. It is not a standard or protocol but rather a set of constraints that guide the design of distributed systems. These constraints ensure that the system remains flexible, extensible, and evolves with changing requirements.

Design Guidelines of RESTful Architecture

  • Resources: Everything on the network is abstracted as a resource. A resource can be any entity that can be named, such as a document, an image, or a service. Each resource is uniquely identified by a URI (Uniform Resource Identifier), which acts as a global identifier for that resource.

  • Resource Representations: Resources are represented in different formats like JSON, XML, or HTML. Clients request a specific representation of a resource, and servers respond with the requested representation.

  • Client-Server Separation: The client-server constraint ensures that the client and server roles are clearly defined, allowing them to evolve independently. This separation of concerns simplifies the overall system by enabling the reuse of components and facilitating parallel development.

  • Statelessness: Each request from the client to the server must contain all the information necessary to understand the request. The server does not store any client-specific state, ensuring that each request can be processed independently.

  • Cacheability: Responses from the server can be cached to improve performance. Caching mechanisms help reduce the load on the server and speed up the delivery of content to clients.

  • Uniform Interface: RESTful systems adhere to a uniform interface that defines a set of constraints, including resource identification in requests, self-descriptive messages, and standardized methods for interacting with resources.

  • Layered System: REST allows intermediaries, such as proxies and gateways, to be introduced at various points in the communication without changing the interfaces between components. This layering provides a flexible and extensible system.

  • Code-on-Demand: Servers can provide executable code to clients, which can be used to customize the client’s request or response processing. This feature enables dynamic customization of the client’s capabilities.

Three New Specifications in RESTful Architecture

  • Uniform Interface: In the RESTful world, everything is abstracted as a resource. This uniform interface simplifies the architecture by providing a consistent way to interact with different types of resources.

  • Layered System: The layered system constraint allows the introduction of intermediary components, such as load balancers, proxies, and firewalls, without modifying the core architecture. This layering enhances security, scalability, and manageability of the system.

  • On-Demand Code: By providing executable code to clients, RESTful systems can adapt to changing requirements and environments. This feature enables dynamic customization and extensibility of the client’s behavior.

See

https://ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation.pdf
https://www.redhat.com/en/blog/rest-architecture

你可能感兴趣的:(New,Developer,软件工程,&,ME,&,GPT,Spring.IO,&,GPT,&,ME,restful)