当前位置:网站首页>Use and principle of rest
Use and principle of rest
2022-07-25 10:12:00 【You learned Ma today】
1. When we Need to use delete and put When sending a request by , You will find that the default way of request is get, We need to configure a hiddenHttpMethodFilter ,springboot It's configured by default , We need to start it manually .

Opening mode , It can also be said to be the way of use


By default post The way , Just in the hidden field _method The latter designation is based on put perhaps delete The way is ok
The last step : stay yml Open... In the configuration file hiddenHttpMethodFilter
spring:
mvc:
hiddenmethod:
filter:
enabled: trueIf we need to modify the default Hide domain name _method
Fang fa : Through one method, it becomes 了 _Z

package com.zwz.springbootweb.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.HiddenHttpMethodFilter;
@Configuration(proxyBeanMethods = false)
public class WebConfig {
@Bean
public HiddenHttpMethodFilter hiddenHttpMethodFilter(){
HiddenHttpMethodFilter hiddenHttpMethodFilter = new HiddenHttpMethodFilter();
hiddenHttpMethodFilter.setMethodParam("_Z");
return hiddenHttpMethodFilter;
}
}
Rest principle :
The form submission will bring _method=PUT, Ask to come and be HiddenHttpMethodFilter Intercept , Check whether the request is normal , And is POST
Get _method Value ( Compatible with the following requests :PUT.DELETE.PATCH)
Native request(post), Packaging mode requesWrapper Rewrote getMethod Method , The returned value is the passed in value .
When the filter chain is used wrapper. Future method calls getMethod Is to call requesWrapper
If you are developing on the client such as Android, you don't need to use HiddenHttpMethodFilter, Direct use of native servelt Drop corresponding method
边栏推荐
- 字符串切片的用法
- Probabilistic robot learning notes Chapter 2
- 工程监测无线中继采集仪和无线网络的优势
- canal实现mysql数据同步
- Internal structure of SOC chip
- See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent
- 无线振弦采集仪的使用常见问题
- @Import,Conditional和@ImportResourse注解
- Armv8 datasheet learning
- Data viewing and parameter modification of multi-channel vibrating wire, temperature and analog sensing signal acquisition instrument
猜你喜欢
![腾讯云之错误[100007] this env is not enable anonymous login](/img/a2/a209a0d94e3fbf607242c28d87e2dd.png)
腾讯云之错误[100007] this env is not enable anonymous login

Exciting method and voltage of vibrating wire sensor by hand-held vibrating wire acquisition instrument

JDBC总结

SystemVerilog syntax

无线振弦采集仪参数配置工具的设置

CCF 201509-4 Expressway
![严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件](/img/39/6f6760e80acec0b02028ea2ed1a5b1.png)
严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件

VScode配置ROS开发环境:修改代码不生效问题原因及解决方法

TM1637带秒点四位LED显示器模块ARDUINO驱动程序

Mlx90640 infrared thermal imager temperature measurement module development instructions
随机推荐
vscode插件开发
TM1637带秒点四位LED显示器模块ARDUINO驱动程序
Download and installation of QT 6.2
Vant problem record
oracle 解析同名xml 问题
framework打包合并脚本
ESP32连接阿里云MQTT物联网平台
CCF 201509-2 date calculation
UE4 外部打开exe文件
工程监测无线中继采集仪和无线网络的优势
Filter过滤器详解(监听器以及它们的应用)
Exciting method and voltage of vibrating wire sensor by hand-held vibrating wire acquisition instrument
JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time
yarn速查手册
GCD详解
SD/SDIO/EMMC
ROS分布式操作--launch文件启动多个机器上的节点
代码整洁之道--直击痛点
拷贝过来老的项目变成web项目
无线振弦采集仪应用工程安全监测