update MyFilter.java

This commit is contained in:
weiweiw 2024-07-05 10:54:25 +08:00
parent 36ccf782bd
commit 256899fa06
2 changed files with 6 additions and 4 deletions

View File

@ -33,4 +33,9 @@ public class SystemGlobal {
*/
public final static String POST="POST";
/**
* PUT 请求
*/
public final static String PUT="PUT";
}

View File

@ -19,16 +19,13 @@ import java.io.IOException;
import static cn.hutool.http.Method.POST;
import static jdk.nashorn.internal.runtime.PropertyDescriptor.GET;
/**
* @author bonus
*/
@Component
@WebFilter("/*")
public class MyFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (SystemGlobal.POST.equals(request.getMethod())){
if (SystemGlobal.POST.equals(request.getMethod()) || SystemGlobal.PUT.equals(request.getMethod()) ){
//去除文件上传
String header = request.getHeader(HttpHeaders.CONTENT_TYPE);
if(StringUtils.isNotEmpty(header)){