Rest is an English representational state transfer (representational state transition) or representational status transfer, which is an architectural style of Web services. Use widely popular standards and protocols such as http,uri,xml,json,html; lightweight, cross-platform, cross-language architecture design; it is a design style, not a standard, is a kind of thought.
The main principles of the rest architecture:
Everything on the network is abstracted as a resource;
Each resource has a unique resource identifier;
The same resource has multiple manifestations (xml,json, etc.);
Various operations on resources do not alter resource identifiers;
All operations are stateless;
A restful approach can be described as an architectural method that conforms to the rest principle.
What is restful? The corresponding Chinese is restful; RESTful web service is a common rest application that adheres to restful web services, and RESTful Web services is a kind of roa (the resource-oriented Architecture) (Resource-oriented architecture).
Why is there a restful?
Before the restful operation:
HTTP://127.0.0.1/USER/QUERY/1 GET query user data based on user ID
Http://127.0.0.1/user/save POST New User
Http://127.0.0.1/user/update POST Modifying user information
Http://127.0.0.1/user/delete get/post Delete User information
RESTful usage:
HTTP://127.0.0.1/USER/1 GET query user data based on user ID
Http://127.0.0.1/user POST New User
Http://127.0.0.1/user PUT Modify user Information
Http://127.0.0.1/user Delete User Information
SPRINGMVC's original ecosystem supports the rest-style architecture design, which involves annotations:
[Email protected] [Email protected] [Email protected]
Front-end access page index.jsp:
<%@ page contenttype= "Text/html;charset=utf-8" language= "java"%>Background controller TestController2. Java:
Package Com.itszt.controller;import Org.springframework.stereotype.controller;import Org.springframework.web.bind.annotation.pathvariable;import org.springframework.web.bind.annotation.requestmapping;/** * Test restful */@RequestMapping ("Test2") @ Controllerpublic class TestController2 { @RequestMapping ("Delete/{delid}/{deltitle}") Public String Delete ( @PathVariable (name = "Delid") string delid, @PathVariable (name = "Deltitle") string deltitle) { System.out.println (" Delid = ["+ Delid +"], Deltitle = ["+ Deltitle +"] "); return "result";
RESTful for URL simplification