update 格式化全部代码
This commit is contained in:
+4
-4
@@ -1,9 +1,9 @@
|
||||
package org.dromara.common.web.core;
|
||||
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@@ -32,9 +32,9 @@ public class I18nLocaleResolver implements LocaleResolver {
|
||||
/**
|
||||
* 当前项目不在服务端主动切换区域信息,因此保留空实现。
|
||||
*
|
||||
* @param httpServletRequest 当前请求
|
||||
* @param httpServletRequest 当前请求
|
||||
* @param httpServletResponse 当前响应
|
||||
* @param locale 目标区域
|
||||
* @param locale 目标区域
|
||||
*/
|
||||
@Override
|
||||
public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {
|
||||
|
||||
+17
-17
@@ -26,7 +26,7 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 构造默认长度为 4 的验证码。
|
||||
*
|
||||
* @param width 图片宽度
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
*/
|
||||
public WaveAndCircleCaptcha(int width, int height) {
|
||||
@@ -36,8 +36,8 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 构造指定验证码长度的验证码对象。
|
||||
*
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param codeCount 验证码字符数
|
||||
*/
|
||||
public WaveAndCircleCaptcha(int width, int height, int codeCount) {
|
||||
@@ -47,9 +47,9 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 构造指定字符数与干扰数的验证码对象。
|
||||
*
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param codeCount 验证码字符数
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param codeCount 验证码字符数
|
||||
* @param interfereCount 干扰元素数量
|
||||
*/
|
||||
public WaveAndCircleCaptcha(int width, int height, int codeCount, int interfereCount) {
|
||||
@@ -59,9 +59,9 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 使用指定验证码生成器构造验证码对象。
|
||||
*
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param generator 验证码生成器
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param generator 验证码生成器
|
||||
* @param interfereCount 干扰元素数量
|
||||
*/
|
||||
public WaveAndCircleCaptcha(int width, int height, CodeGenerator generator, int interfereCount) {
|
||||
@@ -71,11 +71,11 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 构造带字体缩放比例的验证码对象。
|
||||
*
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param codeCount 验证码字符数
|
||||
* @param width 图片宽度
|
||||
* @param height 图片高度
|
||||
* @param codeCount 验证码字符数
|
||||
* @param interfereCount 干扰元素数量
|
||||
* @param size 字体相对尺寸
|
||||
* @param size 字体相对尺寸
|
||||
*/
|
||||
public WaveAndCircleCaptcha(int width, int height, int codeCount, int interfereCount, float size) {
|
||||
super(width, height, new RandomGenerator(codeCount), interfereCount, size);
|
||||
@@ -111,7 +111,7 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 绘制验证码文本并开启文字抗锯齿。
|
||||
*
|
||||
* @param g 图形上下文
|
||||
* @param g 图形上下文
|
||||
* @param code 验证码文本
|
||||
*/
|
||||
private void drawString(Graphics2D g, String code) {
|
||||
@@ -155,7 +155,7 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 绘制平滑波浪线干扰轨迹。
|
||||
*
|
||||
* @param g 图形上下文
|
||||
* @param g 图形上下文
|
||||
* @param random 随机数生成器
|
||||
*/
|
||||
private void drawSmoothWave(Graphics2D g, ThreadLocalRandom random) {
|
||||
@@ -185,8 +185,8 @@ public class WaveAndCircleCaptcha extends AbstractCaptcha {
|
||||
/**
|
||||
* 生成指定 RGB 范围内的随机颜色。
|
||||
*
|
||||
* @param min 最小颜色值
|
||||
* @param max 最大颜色值
|
||||
* @param min 最小颜色值
|
||||
* @param max 最大颜色值
|
||||
* @param random 随机数生成器
|
||||
* @return 随机颜色
|
||||
*/
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package org.dromara.common.web.filter;
|
||||
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import jakarta.servlet.*;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -28,10 +28,10 @@ public class RepeatableFilter implements Filter {
|
||||
/**
|
||||
* 为 JSON 请求创建可重复读取的包装器,便于日志、验签等场景多次读取请求体。
|
||||
*
|
||||
* @param request 原始请求
|
||||
* @param request 原始请求
|
||||
* @param response 当前响应
|
||||
* @param chain 过滤器链
|
||||
* @throws IOException IO 异常
|
||||
* @param chain 过滤器链
|
||||
* @throws IOException IO 异常
|
||||
* @throws ServletException Servlet 异常
|
||||
*/
|
||||
@Override
|
||||
|
||||
+2
-3
@@ -1,13 +1,12 @@
|
||||
package org.dromara.common.web.filter;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
|
||||
import jakarta.servlet.ReadListener;
|
||||
import jakarta.servlet.ServletInputStream;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequestWrapper;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -29,7 +28,7 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
|
||||
/**
|
||||
* 读取原始请求体并缓存到内存,统一设置请求与响应编码。
|
||||
*
|
||||
* @param request 原始请求
|
||||
* @param request 原始请求
|
||||
* @param response 当前响应
|
||||
* @throws IOException 读取请求体异常
|
||||
*/
|
||||
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
package org.dromara.common.web.filter;
|
||||
|
||||
import jakarta.servlet.*;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.web.config.properties.XssProperties;
|
||||
import org.springframework.http.HttpMethod;
|
||||
|
||||
import jakarta.servlet.*;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -42,10 +42,10 @@ public class XssFilter implements Filter {
|
||||
/**
|
||||
* 对请求执行 XSS 包装处理,命中排除规则时直接放行。
|
||||
*
|
||||
* @param request 原始请求
|
||||
* @param request 原始请求
|
||||
* @param response 当前响应
|
||||
* @param chain 过滤器链
|
||||
* @throws IOException IO 异常
|
||||
* @param chain 过滤器链
|
||||
* @throws IOException IO 异常
|
||||
* @throws ServletException Servlet 异常
|
||||
*/
|
||||
@Override
|
||||
@@ -64,7 +64,7 @@ public class XssFilter implements Filter {
|
||||
/**
|
||||
* 判断当前请求是否需要跳过 XSS 过滤。
|
||||
*
|
||||
* @param request 当前请求
|
||||
* @param request 当前请求
|
||||
* @param response 当前响应
|
||||
* @return true 表示跳过过滤
|
||||
*/
|
||||
|
||||
+6
-6
@@ -43,9 +43,9 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 请求进入控制器前记录入参并启动耗时统计。
|
||||
*
|
||||
* @param request 当前请求
|
||||
* @param request 当前请求
|
||||
* @param response 当前响应
|
||||
* @param handler 目标处理器
|
||||
* @param handler 目标处理器
|
||||
* @return 始终返回 true,继续后续处理流程
|
||||
* @throws Exception 读取请求体或解析 JSON 失败时抛出
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 递归移除 JSON 节点中的敏感字段,避免在日志中输出密码等敏感信息。
|
||||
*
|
||||
* @param node 当前 JSON 节点
|
||||
* @param node 当前 JSON 节点
|
||||
* @param excludeProperties 需要排除的字段名集合
|
||||
*/
|
||||
private void removeSensitiveFields(JsonNode node, String[] excludeProperties) {
|
||||
@@ -142,10 +142,10 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 请求完成后输出最终耗时,并清理线程内缓存的计时器。
|
||||
*
|
||||
* @param request 当前请求
|
||||
* @param request 当前请求
|
||||
* @param response 当前响应
|
||||
* @param handler 目标处理器
|
||||
* @param ex 请求处理过程中的异常
|
||||
* @param handler 目标处理器
|
||||
* @param ex 请求处理过程中的异常
|
||||
* @throws Exception 拦截器链路抛出的异常
|
||||
*/
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user