refactor(web): 请求响应可重复读流处理由 core 调整到 web 模块

This commit is contained in:
2025-03-26 20:43:16 +08:00
parent 85285e56a8
commit 21262701dc
14 changed files with 70 additions and 70 deletions

View File

@@ -23,6 +23,12 @@
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<!-- AOPAspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<!-- Hibernate Validator -->
<dependency>
<groupId>org.hibernate.validator</groupId>
@@ -59,12 +65,5 @@
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
</dependency>
<!-- Jakarta原 Javax Servlet -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -40,45 +40,40 @@ public class PropertiesConstants {
public static final String SECURITY = CONTINEW_STARTER + StringConstants.DOT + "security";
/**
* 密码编解码配置
* 安全-密码编解码配置
*/
public static final String SECURITY_PASSWORD = SECURITY + StringConstants.DOT + "password";
/**
* 加/解密配置
* 安全-加/解密配置
*/
public static final String SECURITY_CRYPTO = SECURITY + StringConstants.DOT + "crypto";
/**
* 敏感词配置
* 安全-敏感词配置
*/
public static final String SECURITY_SENSITIVE_WORDS = SECURITY + StringConstants.DOT + "sensitive-words";
/**
* 安全-XSS 配置
*/
public static final String SECURITY_XSS = SECURITY + StringConstants.DOT + "xss";
/**
* Web 配置
*/
public static final String WEB = CONTINEW_STARTER + StringConstants.DOT + "web";
/**
* 跨域配置
* Web-跨域配置
*/
public static final String WEB_CORS = WEB + StringConstants.DOT + "cors";
/**
* 响应配置
* Web-响应配置
*/
public static final String WEB_RESPONSE = WEB + StringConstants.DOT + "response";
/**
* 链路配置
*/
public static final String WEB_TRACE = WEB + StringConstants.DOT + "trace";
/**
* XSS 配置
*/
public static final String WEB_XSS = WEB + StringConstants.DOT + "xss";
/**
* 日志配置
*/
@@ -89,11 +84,6 @@ public class PropertiesConstants {
*/
public static final String STORAGE = CONTINEW_STARTER + StringConstants.DOT + "storage";
/**
* 本地存储配置
*/
public static final String STORAGE_LOCAL = STORAGE + StringConstants.DOT + "local";
/**
* 验证码配置
*/
@@ -144,6 +134,11 @@ public class PropertiesConstants {
*/
public static final String IDEMPOTENT = CONTINEW_STARTER + StringConstants.DOT + "idempotent";
/**
* 链路追踪配置
*/
public static final String TRACE = CONTINEW_STARTER + StringConstants.DOT + "trace";
private PropertiesConstants() {
}
}

View File

@@ -538,20 +538,6 @@
<version>${revision}</version>
</dependency>
<!-- 幂等模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-idempotent</artifactId>
<version>${revision}</version>
</dependency>
<!-- 限流模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
<version>${revision}</version>
</dependency>
<!-- 日志模块 - 基于拦截器实现Spring Boot Actuator HttpTrace 增强版) -->
<dependency>
<groupId>top.continew</groupId>
@@ -573,13 +559,33 @@
<version>${revision}</version>
</dependency>
<!-- Web 模块 -->
<!-- 链路追踪模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-web</artifactId>
<artifactId>continew-starter-trace</artifactId>
<version>${revision}</version>
</dependency>
<!-- 幂等模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-idempotent</artifactId>
<version>${revision}</version>
</dependency>
<!-- 限流模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-ratelimiter</artifactId>
<version>${revision}</version>
</dependency>
<!-- 安全模块 - XSS 过滤 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-security-xss</artifactId>
</dependency>
<!-- 安全模块 - 敏感词 -->
<dependency>
<groupId>top.continew</groupId>
@@ -608,6 +614,13 @@
<version>${revision}</version>
</dependency>
<!-- Web 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-web</artifactId>
<version>${revision}</version>
</dependency>
<!-- API 文档模块 -->
<dependency>
<groupId>top.continew</groupId>

View File

@@ -18,5 +18,11 @@
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
</dependency>
<!-- TTL线程间传递 ThreadLocal异步执行时上下文传递的解决方案 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -25,8 +25,8 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.core.Ordered;
import org.springframework.lang.NonNull;
import org.springframework.web.filter.OncePerRequestFilter;
import top.continew.starter.core.wrapper.RepeatReadRequestWrapper;
import top.continew.starter.core.wrapper.RepeatReadResponseWrapper;
import top.continew.starter.web.util.RepeatReadRequestWrapper;
import top.continew.starter.web.util.RepeatReadResponseWrapper;
import top.continew.starter.log.model.LogProperties;
import java.io.IOException;

View File

@@ -19,9 +19,9 @@ package top.continew.starter.log.http.servlet;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.json.JSONUtil;
import jakarta.servlet.http.HttpServletResponse;
import top.continew.starter.core.wrapper.RepeatReadResponseWrapper;
import top.continew.starter.log.http.RecordableHttpResponse;
import top.continew.starter.web.util.ServletUtils;
import top.continew.starter.web.util.RepeatReadResponseWrapper;
import top.continew.starter.log.http.RecordableHttpResponse;
import java.util.Map;

View File

@@ -20,9 +20,9 @@ import cn.hutool.core.text.CharSequenceUtil;
import org.springframework.http.HttpHeaders;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.core.util.IpUtils;
import top.continew.starter.web.util.ServletUtils;
import top.continew.starter.log.enums.Include;
import top.continew.starter.log.http.RecordableHttpRequest;
import top.continew.starter.web.util.ServletUtils;
import java.net.URI;
import java.util.Map;

View File

@@ -13,12 +13,6 @@
<description>ContiNew Starter 日志模块 - 基于拦截器实现Spring Boot Actuator HttpTrace 增强版)</description>
<dependencies>
<!-- TTL线程间传递 ThreadLocal异步执行时上下文传递的解决方案 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
</dependency>
<!-- 日志模块 - 核心模块 -->
<dependency>
<groupId>top.continew</groupId>

View File

@@ -20,10 +20,10 @@
</modules>
<dependencies>
<!-- 核心模块 -->
<!-- Web 模块 -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-core</artifactId>
<artifactId>continew-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -38,12 +38,6 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- TLog轻量级的分布式日志标记追踪神器 -->
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>tlog-web-spring-boot-starter</artifactId>
</dependency>
<!-- Graceful Response一个Spring Boot技术栈下的优雅响应处理组件可以帮助开发者完成响应数据封装、异常处理、错误码填充等过程提高开发效率提高代码质量 -->
<dependency>
<groupId>com.feiniaojin</groupId>

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.starter.core.wrapper;
package top.continew.starter.web.util;
import cn.hutool.core.io.IoUtil;
import jakarta.servlet.ReadListener;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package top.continew.starter.core.wrapper;
package top.continew.starter.web.util;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.WriteListener;

View File

@@ -1,4 +1,2 @@
top.continew.starter.web.autoconfigure.mvc.WebMvcAutoConfiguration
top.continew.starter.web.autoconfigure.cors.CorsAutoConfiguration
top.continew.starter.web.autoconfigure.trace.TraceAutoConfiguration
top.continew.starter.web.autoconfigure.xss.XssAutoConfiguration
top.continew.starter.web.autoconfigure.cors.CorsAutoConfiguration

View File

@@ -61,8 +61,11 @@
<module>continew-starter-core</module>
<module>continew-starter-json</module>
<module>continew-starter-api-doc</module>
<module>continew-starter-security</module>
<module>continew-starter-web</module>
<module>continew-starter-security</module>
<module>continew-starter-ratelimiter</module>
<module>continew-starter-idempotent</module>
<module>continew-starter-trace</module>
<module>continew-starter-log</module>
<module>continew-starter-storage</module>
<module>continew-starter-file</module>
@@ -71,8 +74,6 @@
<module>continew-starter-data</module>
<module>continew-starter-auth</module>
<module>continew-starter-messaging</module>
<module>continew-starter-ratelimiter</module>
<module>continew-starter-idempotent</module>
<module>continew-starter-extension</module>
</modules>