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:
@@ -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