当前位置:网站首页>Basics - rest style development
Basics - rest style development
2022-07-05 11:08:00 【Printf ('xiaobai ');】
REST Style development
How to write it
- Representational State Transfer, Representation state transition
- advantage
- Hide access behavior , It is impossible to know what kind of operation the resource is through the address
Writing simplification
- Hide access behavior , It is impossible to know what kind of operation the resource is through the address
http://locahost/users Query all user information GET
http://locahost/users/1 Query individual user information GET
http://locahost/users Add user information POST
http://locahost/users Modify user information PUT
http://locahost/users/1 Delete user information DELETE
- It's a style, not a norm , With REST Style development is called RESTFUL
- The name describing the module is usually plural , That is to say, add s Format description of , Indicates such resources , Not a single resource , for example users, books, accounts
Several notes
@RequestBody @RequestParam @PathVariable
- difference
- @RequestParam It is used to receive
url Address reference
perhapsPass the form to the reference
@RequestBody be used forreceive json data
@PathVariable Used to receive path parameters , Use{ Parameter name }
Describe path parameters
- @RequestParam It is used to receive
- application
- Later development , Hair
Send request parameters more than one
when , Withjson Mainly
,@RequestBody It is widely used
send outNot json Format data
, choose @RequestParam Receive request parametersuse RESTful Development , When the number of parameters is small
, For example, one , May adopt @PathVariable Receive request path variable , Usually used for id Pass value
- Later development , Hair
@RestController
- yes @Controller and @ResponseBody The aggregate of
@PostMapping
- @RequestMapping(method = RequestMethod.POST)
边栏推荐
- 使用bat命令一键启动常用浏览器
- Cross page communication
- 使用GBase 8c数据库过程中报错:80000502,Cluster:%s is busy,是怎么回事?
- Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
- Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?
- How can gbase 8C database view the login information of the login user, such as the date, time and IP of the last login authentication?
- Network security of secondary vocational group 2021 Jiangsu provincial competition 5 sets of topics environment + analysis of all necessary private messages I
- Go language learning notes - first acquaintance with go language
- 2022 Pengcheng cup Web
- Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
猜你喜欢
基于昇腾AI丨爱笔智能推出银行网点数字化解决方案,实现从总部到网点的信息数字化全覆盖
DGL中异构图的一些理解以及异构图卷积HeteroGraphConv的用法
修复动漫1K变8K
How to make full-color LED display more energy-saving and environmental protection
Detailed explanation of MATLAB cov function
在C# 中实现上升沿,并模仿PLC环境验证 If 语句使用上升沿和不使用上升沿的不同
Basic testing process of CSDN Software Testing Introduction
Three suggestions for purchasing small spacing LED display
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
Repair animation 1K to 8K
随机推荐
BOM//
Network security of secondary vocational group 2021 Jiangsu provincial competition 5 sets of topics environment + analysis of all necessary private messages I
[first release in the whole network] (tips for big tables) sometimes it takes only 1 minute for 2 hours of SQL operation
R3Live系列学习(四)R2Live源码阅读(2)
运算符、、
Advanced scaffold development
SQL Server monitoring statistics blocking script information
9、 Disk management
Bracket matching problem (STL)
Node の MongoDB Driver
2021 Shandong provincial competition question bank topic capture
九、磁盘管理
Do you really understand the things about "prototype"? [part I]
谈谈对Flink框架中容错机制及状态的一致性的理解
Lazy loading scheme of pictures
基于昇腾AI丨以萨技术推出视频图像全目标结构化解决方案,达到业界领先水平
【Oracle】使用DataGrip连接Oracle数据库
Use bat command to launch common browsers with one click
Question bank and answers of special operation certificate examination for main principals of hazardous chemical business units in 2022
华为设备配置信道切换业务不中断