当前位置:网站首页>Is restful style really necessary?
Is restful style really necessary?
2022-07-21 17:23:00 【ZJH'blog】
Up to now, I have gone through two internships , Also because I like surfing the Internet , I know many friends from big factories . Anyway, everyone's consensus is Restful The benefits outweigh the disadvantages . I checked the information for a few days , To sum up a little
Why not Restful
1. Browser aspect
- Browsers are generally right GET and POST The best support for
- Browser form form Submission only supports GET and POST
2.SpringMVC aspect
- SpringMVC analysis POST The request can be parsed automatically param and body, No comments needed , and PUT DELETE Request must be added @RequestParam、@PathVariable、@RequestBody annotation , although Spring3 Support for PUT Mapping of request body , But it needs to be in web.xml perhaps WebMvcConfigurerAdapter To configure ———————— This is really useful , I have maintained this project for a long time and feel it is really convenient , Many fields that do not need to be matched can be written directly
3. Business aspect
- One “ Delete ”“ Change ” The operation may not be so clean , There may be a lot of “ check ”“ increase ” operation , But with one PUT Even basic RESTful Our advantages have become disadvantages
- The different operations of adding, deleting, modifying and querying can be done through url To distinguish : for example */deleteXxxx or editXxxx
4.Http In terms of agreement
- meanwhile ,POST Requests are submitted twice by default in most browsers tcp package , It's safer when the network environment is poor
- PUT and DELETE stay http The essence of the agreement and POST equally , There is no advantage , Instead, the SpringMVC Some problems are easy to appear in
When can I use Restful
If and only if
- Idempotent modification delete It can be used put,delete; Not idempotent post
- Deleting is deleting , Modification is modification , It will not affect other business data
- Training institutions deceive xiaobaishi
Get and Post Some of the differences
- “ Whether to submit a large amount of data ” The function of can be directly determined by POST and GET To distinguish between ,GET Can't put body Parameters , Data can only be exposed in url On , But browsers url The length of is mostly limited to 2kb, It can be used POST Let's play it body Parameters .
- GET The requested request data may be cached by the browser
- If the request is not idempotent, use GET, If the result is cached, an error will occur , By request Parameters with timestamp, etc. do not repeat irrelevant parameters To enforce cache prevention
- If sensitive information is used GET, Then your sensitive information may be completely saved in the local browser . Of course , It can be solved by encryption
边栏推荐
- Huawei wireless device roaming configures non fast roaming between APs of the same service VLAN
- [method] determine whether exe or DLL is 32-bit or 64 bit
- 三级调度之间的联系及区别
- Apple Mobile App full screen
- 实践-创建多少线程合适
- Acme Automation - free SSL certificate application and automatic renewal
- 竣达技术丨MOBUS 转SNMP网络监控终端
- cv demo
- Writing GPIO driver for raspberry pie (detailed tutorial)
- Byte order - big endian / small endian, big endian / little endian
猜你喜欢
让实习生搭个Redis集群,差点把我”搭“进去~~~
有了线程后,发生的变化
花6000报了测试培训班,3个月后我成功“骗”进了腾讯,月薪拿17k
It seems to be a bug of thread pool, but I think the source code design is unreasonable.
卷积神经网络单图超分辨率的深度学习方法
华为无线设备配置不同业务VLAN的AP间非快速漫游
华为无线设备配置同一业务VLAN的AP间快速漫游
What is a video content recommendation engine?
Detailed explanation of JUC concurrent programming wait notify
Ccs3 comprehensive experiment -- stylesheet file -- design a menu page
随机推荐
This year, if you endure, you will have hope
[Interview: concurrence19: Multithreading: Park & unpark]
进程的组织方式:链接方式和索引方式
联邦学习: 联邦场景下的时空数据挖掘
SAP FIORI专题之二:用webide构建带导航栏的fiori
支持向量机进行枣类遗传的回归预测分析
如何分析并设计性能测试场景
[pictures and texts] this article explains the JVM architecture, class file structure and bytecode structure!!
各大主流编程语言性能PK,结果出乎意料
shell脚本按日期范围和间隔下载数据
12、用户微服务
[method] determine whether exe or DLL is 32-bit or 64 bit
[solution] VC6.0 cannot be debugged at breakpoints
超简单的三管无感无刷三相电机驱动板
华为无线设备WLAN QoS配置命令
Kube controller manager principle
Interview must ask, how to ensure the idempotency of the interface?
Kubernetes service load balancing implementation mechanism
Huawei wireless devices are configured with fast roaming between APs of the same service VLAN
管程 的相关内容