0
点赞
收藏
分享

微信扫一扫

Rest使用与原理

蓝莲听雨 2022-03-18 阅读 46

1.当我们 需要用到delete和put方式发送请求时,会发现请求的默认方式还是get,我们需要配置一个 hiddenHttpMethodFilter ,springboot已经默认配置好了,我们需要手动去开启.

开启方式,也可以说是使用方式

 

 

默认使用post方式,只需要在隐藏域 _method后指定是以put或者delete方式就ok

最后一步:在yml配置文件中开启hiddenHttpMethodFilter

spring:
  mvc:
    hiddenmethod:
      filter:
        enabled: true

原理:

 

若在客户端比如安卓开发不需要用 HiddenHttpMethodFilter,直接用原生servelt掉对应方法

举报

相关推荐

0 条评论