docs 补充项目注释

This commit is contained in:
AprilWind
2026-06-01 13:58:13 +08:00
parent 107d3326b4
commit e49f3b2260
94 changed files with 2328 additions and 68 deletions
@@ -23,6 +23,7 @@ public class FilterConfig {
/**
* 注册 XSS 过滤器。
*
* @param xssProperties XSS 配置
* @return XSS 请求过滤器实例
*/
@Bean
@@ -21,6 +21,9 @@ import java.nio.charset.StandardCharsets;
* @author ruoyi
*/
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
/**
* 请求体字节数据。
*/
private final byte[] body;
/**
@@ -59,26 +62,53 @@ public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
public ServletInputStream getInputStream() throws IOException {
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
return new ServletInputStream() {
/**
* 读取缓存请求体的下一个字节。
*
* @return 下一个字节
* @throws IOException IO 异常
*/
@Override
public int read() throws IOException {
return bais.read();
}
/**
* 返回缓存请求体剩余可读字节数。
*
* @return 剩余字节数
* @throws IOException IO 异常
*/
@Override
public int available() throws IOException {
return bais.available();
}
/**
* 判断缓存请求体是否已读取完毕。
*
* @return 是否读取完毕
*/
@Override
public boolean isFinished() {
return bais.available() == 0;
}
/**
* 判断输入流是否可读。
*
* @return 固定为 true
*/
@Override
public boolean isReady() {
return true;
}
/**
* 设置异步读取监听器。
*
* @param readListener 读取监听器
*/
@Override
public void setReadListener(ReadListener readListener) {
@@ -124,25 +124,52 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8);
final ByteArrayInputStream bis = IoUtil.toStream(jsonBytes);
return new ServletInputStream() {
/**
* 判断清洗后的 JSON 流是否已读取完毕。
*
* @return 是否读取完毕
*/
@Override
public boolean isFinished() {
return true;
}
/**
* 判断清洗后的 JSON 流是否可读。
*
* @return 固定为 true
*/
@Override
public boolean isReady() {
return true;
}
/**
* 返回清洗后的 JSON 字节数。
*
* @return JSON 字节数
* @throws IOException IO 异常
*/
@Override
public int available() throws IOException {
return jsonBytes.length;
}
/**
* 设置异步读取监听器。
*
* @param readListener 读取监听器
*/
@Override
public void setReadListener(ReadListener readListener) {
}
/**
* 读取清洗后的 JSON 流下一个字节。
*
* @return 下一个字节
* @throws IOException IO 异常
*/
@Override
public int read() throws IOException {
return bis.read();