当前位置:网站首页>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
边栏推荐
- VS无线振弦采集仪蓝牙功能的使用
- C3D模型pytorch源码逐句详析(二)
- 链表相关(设计链表及环链表问题)
- 1、 Initial mysql, MySQL installation, environment configuration, initialization
- rospy Odometry天坑小计
- Arm preliminaries
- RedisUtil
- Detailed explanation of MySQL database
- 入住阿里云MQTT物联网平台
- 概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
猜你喜欢

CCF 201509-4 Expressway

JDBC总结

CCF 201512-4 delivery

CentOs安装redis

JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time

看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer

See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent

工程监测无线中继采集仪和无线网络的优势

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

Fundamentals of C language
随机推荐
数据库MySQL详解
看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer
阿里MQTT物联网平台“云产品流转”实战——两片ESP32通过物联网平台实现远程互操作
安装 oh my zsh
Download and installation of QT 6.2
字符串切片的用法
LoRA转4G及网关中继器工作原理
Leetcode 560 前缀和+哈希表
js数字千位分割的常用方法
力扣刷题组合问题总结(回溯)
VCs common commands
广度优先遍历(图和二叉树的层序遍历相关问题)
UE4 窗口控制(最大化 最小化)
C3D模型pytorch源码逐句详析(三)
无线中继采集仪的常见问题
@Import,Conditional和@ImportResourse注解
工程监测无线中继采集仪和无线网络的优势
严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件
文件的上传功能
cookie and session