mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
chore: 优化部分代码格式和注释
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<description>ContiNew Starter 认证模块 - SaToken</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Web 模块 -->
|
||||
<!-- Web 模块 - 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web-core</artifactId>
|
||||
|
@@ -18,7 +18,6 @@ package top.continew.starter.idempotent.aop;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@@ -98,7 +97,7 @@ public class IdempotentAspect {
|
||||
String key = idempotent.key();
|
||||
if (CharSequenceUtil.isNotBlank(key)) {
|
||||
Object eval = ExpressionUtils.eval(key, target, method, args);
|
||||
if (ObjectUtil.isNull(eval)) {
|
||||
if (eval == null) {
|
||||
throw new IdempotentException("幂等 Key 解析错误");
|
||||
}
|
||||
key = Convert.toStr(eval);
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package top.continew.starter.json.jackson.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@@ -61,7 +60,7 @@ public class JSONUtils {
|
||||
* @return {@link String }
|
||||
*/
|
||||
public static String toJsonStr(Object object) {
|
||||
if (ObjectUtil.isNull(object)) {
|
||||
if (object == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
@@ -20,7 +20,7 @@
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<!-- Web 模块 -->
|
||||
<!-- Web 模块 - 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web-core</artifactId>
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<description>ContiNew Starter 限流模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Web 模块 -->
|
||||
<!-- Web 模块 - 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web-core</artifactId>
|
||||
|
@@ -18,7 +18,6 @@ package top.continew.starter.ratelimiter.aop;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
@@ -162,7 +161,7 @@ public class RateLimiterAspect {
|
||||
String key = rateLimiter.key();
|
||||
if (CharSequenceUtil.isNotBlank(key)) {
|
||||
Object eval = ExpressionUtils.eval(key, target, method, args);
|
||||
if (ObjectUtil.isNull(eval)) {
|
||||
if (eval == null) {
|
||||
throw new RateLimiterException("限流 Key 解析错误");
|
||||
}
|
||||
key = Convert.toStr(eval);
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<description>ContiNew Starter 安全模块 - XSS 过滤模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Web 模块 -->
|
||||
<!-- Web 模块 - 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web-core</artifactId>
|
||||
|
@@ -13,18 +13,18 @@
|
||||
<description>ContiNew Starter 链路追踪模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Servlet API -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Servlet API -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- TLog(轻量级的分布式日志标记追踪神器) -->
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
|
@@ -12,6 +12,17 @@
|
||||
<description>ContiNew Starter Web 模块 - 核心模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON 模块 - Jackson -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-json-jackson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Web(提供 Spring MVC Web 开发能力,默认内置 Tomcat 服务器) -->
|
||||
<dependency>
|
||||
@@ -31,21 +42,5 @@
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--核心模块-->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JSON 模块 - Jackson -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-json-jackson</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
@@ -24,7 +24,6 @@ import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
@@ -69,9 +68,6 @@ public class ServletUtils extends JakartaServletUtil {
|
||||
* @return 浏览器及其版本信息
|
||||
*/
|
||||
public static String getBrowser(String userAgentString) {
|
||||
if (StringUtils.isBlank(userAgentString)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
UserAgent userAgent = UserAgentUtil.parse(userAgentString);
|
||||
if (userAgent == null || userAgent.getBrowser() == null) {
|
||||
@@ -79,9 +75,7 @@ public class ServletUtils extends JakartaServletUtil {
|
||||
}
|
||||
String browserName = userAgent.getBrowser().getName();
|
||||
String version = userAgent.getVersion();
|
||||
return StringUtils.isBlank(version)
|
||||
? browserName
|
||||
: browserName + StringConstants.SPACE + version;
|
||||
return CharSequenceUtil.isBlank(version) ? browserName : browserName + StringConstants.SPACE + version;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
@@ -107,9 +101,6 @@ public class ServletUtils extends JakartaServletUtil {
|
||||
* @return 操作系统
|
||||
*/
|
||||
public static String getOs(String userAgentString) {
|
||||
if (StringUtils.isEmpty(userAgentString)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
UserAgent userAgent = UserAgentUtil.parse(userAgentString);
|
||||
if (userAgent == null || userAgent.getOs() == null) {
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web</artifactId>
|
||||
@@ -13,12 +12,19 @@
|
||||
<description>ContiNew Starter Web 模块 - 增强支持模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!--web 模块 - 核心模块-->
|
||||
<!-- Web 模块 - 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-web-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- API 文档模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-api-doc</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Undertow 服务器(采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -30,15 +36,5 @@
|
||||
<groupId>com.feiniaojin</groupId>
|
||||
<artifactId>graceful-response</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- API 文档模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-api-doc</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
Reference in New Issue
Block a user