From 43f0578e80af82ecae6c61b51bd0539c6b960603 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期二, 16 八月 2022 19:08:32 +0800
Subject: [PATCH] 服务范围优化
---
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/FileUploadExceptionAdvice.java | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/FileUploadExceptionAdvice.java b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/FileUploadExceptionAdvice.java
index 970ce9f..ed11f48 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/FileUploadExceptionAdvice.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/FileUploadExceptionAdvice.java
@@ -1,25 +1,24 @@
package com.panzhihua.zuul.handles;
-import com.panzhihua.common.constants.HttpStatus;
-import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.utlis.ResultUtil;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import com.panzhihua.common.constants.HttpStatus;
+import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.utlis.ResultUtil;
@ControllerAdvice
public class FileUploadExceptionAdvice {
@ExceptionHandler(MaxUploadSizeExceededException.class)
- public void handleMaxSizeException(
- MaxUploadSizeExceededException exc,
- HttpServletRequest request,
- HttpServletResponse response) {
- //请求超过大小限制
+ public void handleMaxSizeException(MaxUploadSizeExceededException exc, HttpServletRequest request,
+ HttpServletResponse response) {
+ // 请求超过大小限制
response.setContentType("application/json;charset=utf-8");
ResultUtil.responseJson(response, R.fail(HttpStatus.REQUEST_TOO_LARGE, "请求主体的大小超过限制"));
return;
@@ -27,11 +26,9 @@
}
@ExceptionHandler(FileSizeLimitExceededException.class)
- public void handleFileSizeLimitException(
- FileSizeLimitExceededException exc,
- HttpServletRequest request,
- HttpServletResponse response) {
- //请求超过大小限制
+ public void handleFileSizeLimitException(FileSizeLimitExceededException exc, HttpServletRequest request,
+ HttpServletResponse response) {
+ // 请求超过大小限制
response.setContentType("application/json;charset=utf-8");
ResultUtil.responseJson(response, R.fail(HttpStatus.REQUEST_TOO_LARGE, "文件大小超过限制"));
return;
--
Gitblit v1.7.1