diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
new file mode 100644
index 0000000000000000000000000000000000000000..667577d3e973f00fb99458cd36cf562fe55afb9e
--- /dev/null
+++ b/.github/workflows/maven.yml
@@ -0,0 +1,59 @@
+# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Run Servlet TCK
+
+on:
+ push:
+ branches: [ "jakarta" ]
+ paths-ignore:
+ - 'pages/**'
+ pull_request:
+ branches: [ "jakarta" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/checkout@v4
+ name: 下载servlet TCK
+ with:
+ repository: jakartaee/servlet
+ ref: c533204b8fb04a4b04169e697b3f140b8ea2deb9
+ path: jakartaee/servlet
+ - uses: actions/checkout@v4
+ name: 下载 smart-http
+ with:
+ repository: smartboot/smart-http
+ path: smart-http
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: maven
+ - name: Build smart-http
+ run: mvn -B install --file smart-http/pom.xml -Dmaven.compiler.source=8 -Dmaven.compiler.target=8
+ - name: Build servlet TCK with Maven
+ run: mvn -B install --file jakartaee/servlet/tck/pom.xml -Dmaven.compiler.source=8 -Dmaven.compiler.target=8
+ - name: Build smart-servlet with Maven
+ run: mvn -B install --file pom.xml
+ - name: Build with Maven
+ run: mvn -B verify --file tck/pom.xml -Dbasedir=tck_tmp -Dmaven.test.failure.ignore=true
+ - name: Build with Maven
+ run: mvn -B surefire-report:report --file tck/pom.xml
+
+ - name: Upload test report
+ uses: actions/upload-artifact@v2
+ if: always() # 确保即使有失败的测试也会上传报告
+ with:
+ name: test-report
+ path: tck/target/site
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
new file mode 100644
index 0000000000000000000000000000000000000000..6f02f992135642e7afc46d64f4f982fa1a5a46be
--- /dev/null
+++ b/.github/workflows/pages.yml
@@ -0,0 +1,41 @@
+name: Deploy to GitHub Pages
+
+on:
+ # Trigger the workflow every time you push to the `main` branch
+ # Using a different branch name? Replace `main` with your branch’s name
+ push:
+ branches: [jakarta]
+ paths:
+ - 'pages/**'
+ # Allows you to run this workflow manually from the Actions tab on GitHub.
+ workflow_dispatch:
+
+# Allow this job to clone the repo and create a page deployment
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout your repository using git
+ uses: actions/checkout@v4
+ - name: Install, build, and upload your site output
+ uses: withastro/action@v2
+ with:
+ path: pages # The root location of your Astro project inside the repository. (optional)
+ node-version: 21.1.0 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
+ package-manager: yarn@ # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
+
+ deploy:
+ needs: build
+ runs-on: ubuntu-latest
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b217b4ebddad48662114977a28771e9f3f624624
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,69 @@
+# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
+
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+
+name: Distribution
+
+on:
+ push:
+ branches: [ "jakarta" ]
+ paths-ignore:
+ - 'pages/**'
+ pull_request:
+ branches: [ "jakarta" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/checkout@v4
+ name: 下载 smart-http
+ with:
+ repository: smartboot/smart-http
+ path: smart-http
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: maven
+ - name: Build smart-http
+ run: mvn -B install --file smart-http/pom.xml -Dmaven.compiler.source=8 -Dmaven.compiler.target=8
+ - name: Build smart-servlet with Maven
+ run: mvn -B install --file pom.xml
+
+ # 企业版打包
+ - uses: actions/checkout@v4
+ with:
+ repository: smartboot/smart-servlet-enterprise
+ token: ${{ secrets.GH_PAT }}
+ path: smart-servlet-enterprise
+
+ - name: 构建 smart-jakarta-bin 制品
+ run: mvn clean install -f smart-servlet-enterprise/pom.xml
+ - name: Build distribution with Maven
+ run: mvn clean package -Pbin -f smart-servlet-enterprise/deploy/pom.xml
+ - name: 上传 smart-jakarta-bin 制品
+ uses: actions/upload-artifact@v4
+ with:
+ name: smart-jakarta-bin-${{ github.ref_name }}
+ compression-level: 0
+ path: smart-servlet-enterprise/deploy/target/*.tar.gz
+
+ - name: 构建 smart-jakarta-springboot 制品
+ run: mvn clean package -Pspringboot -f smart-servlet-enterprise/deploy/pom.xml
+ - name: 上传 smart-jakarta-springboot 制品
+ uses: actions/upload-artifact@v4
+ with:
+ name: smart-jakarta-springboot-${{ github.ref_name }}
+ compression-level: 0
+ path: smart-servlet-enterprise/deploy/target/*.tar.gz
+
diff --git a/pages/README.md b/pages/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..e09bf55fefe3d61bdafd7082bf11a64e895d337a
--- /dev/null
+++ b/pages/README.md
@@ -0,0 +1,55 @@
+# Starlight Starter Kit: Basics
+
+[](https://starlight.astro.build)
+
+```
+npm create astro@latest -- --template starlight
+```
+
+[](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
+[](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
+[](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
+[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)
+
+> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
+
+## 🚀 Project Structure
+
+Inside of your Astro + Starlight project, you'll see the following folders and files:
+
+```
+.
+├── public/
+├── src/
+│ ├── assets/
+│ ├── content/
+│ │ ├── docs/
+│ │ └── config.ts
+│ └── env.d.ts
+├── astro.config.mjs
+├── package.json
+└── tsconfig.json
+```
+
+Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.
+
+Images can be added to `src/assets/` and embedded in Markdown with a relative link.
+
+Static assets, like favicons, can be placed in the `public/` directory.
+
+## 🧞 Commands
+
+All commands are run from the root of the project, from a terminal:
+
+| Command | Action |
+| :------------------------ | :----------------------------------------------- |
+| `npm install` | Installs dependencies |
+| `npm run dev` | Starts local dev server at `localhost:4321` |
+| `npm run build` | Build your production site to `./dist/` |
+| `npm run preview` | Preview your build locally, before deploying |
+| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
+| `npm run astro -- --help` | Get help using the Astro CLI |
+
+## 👀 Want to learn more?
+
+Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
diff --git a/pages/astro.config.mjs b/pages/astro.config.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..20ade812961fc39c68704fcd54fbac78626331cc
--- /dev/null
+++ b/pages/astro.config.mjs
@@ -0,0 +1,44 @@
+import { defineConfig } from 'astro/config';
+import starlight from '@astrojs/starlight';
+
+// https://astro.build/config
+export default defineConfig({
+ site: 'https://smartboot.tech/',
+ base: '/smart-servlet',
+ trailingSlash: "always",
+ integrations: [
+ starlight({
+ title: 'smart-servlet',
+ social: {
+ github: 'https://github.com/smartboot/smart-servlet',
+ },
+ // 为此网站设置英语为默认语言。
+ defaultLocale: 'root',
+ locales: {
+ root: {
+ label: '简体中文',
+ lang: 'zh-CN',
+ },
+ // 英文文档在 `src/content/docs/en/` 中。
+ en: {
+ label: 'English',
+ lang: 'en'
+ }
+ },
+ sidebar: [
+ {
+ label: '指南',
+ autogenerate: {directory: 'guides'},
+ },
+ {
+ label: '下载',
+ autogenerate: { directory: 'download' },
+ },
+ {
+ label: '参考',
+ autogenerate: { directory: 'reference' },
+ },
+ ],
+ }),
+ ],
+});
diff --git a/pages/package.json b/pages/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..78eaa2a8fbf66868bf455332c88913ed4c959dd3
--- /dev/null
+++ b/pages/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "",
+ "type": "module",
+ "version": "0.0.1",
+ "scripts": {
+ "dev": "astro dev",
+ "start": "astro dev",
+ "build": "astro build",
+ "preview": "astro preview",
+ "astro": "astro"
+ },
+ "dependencies": {
+ "@astrojs/starlight": "^0.25.2",
+ "astro": "^4.10.2",
+ "sharp": "^0.32.5"
+ }
+}
\ No newline at end of file
diff --git a/pages/public/favicon.svg b/pages/public/favicon.svg
new file mode 100644
index 0000000000000000000000000000000000000000..cba5ac140a25951a20704b481a65514838f0f4b6
--- /dev/null
+++ b/pages/public/favicon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/pages/public/smart-servlet.svg b/pages/public/smart-servlet.svg
new file mode 100644
index 0000000000000000000000000000000000000000..ca70606f171a6ab20eb2581f8650fc4023bd3616
--- /dev/null
+++ b/pages/public/smart-servlet.svg
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/pages/public/springboot_demo.png b/pages/public/springboot_demo.png
new file mode 100644
index 0000000000000000000000000000000000000000..46c30ab9424d3b5ad351a255161d767a17367289
Binary files /dev/null and b/pages/public/springboot_demo.png differ
diff --git a/pages/public/springboot_res.png b/pages/public/springboot_res.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb479a6b4911ee421948bc750173ea7d31ca79c3
Binary files /dev/null and b/pages/public/springboot_res.png differ
diff --git a/pages/src/assets/houston.webp b/pages/src/assets/houston.webp
new file mode 100644
index 0000000000000000000000000000000000000000..930c164974ad8eb528878f15a98016249b8cf546
Binary files /dev/null and b/pages/src/assets/houston.webp differ
diff --git a/pages/src/content/config.ts b/pages/src/content/config.ts
new file mode 100644
index 0000000000000000000000000000000000000000..45f60b01542e20c173efeebce00c60abcc38e9e0
--- /dev/null
+++ b/pages/src/content/config.ts
@@ -0,0 +1,6 @@
+import { defineCollection } from 'astro:content';
+import { docsSchema } from '@astrojs/starlight/schema';
+
+export const collections = {
+ docs: defineCollection({ schema: docsSchema() }),
+};
diff --git a/pages/src/content/docs/download/jakarta_6.md b/pages/src/content/docs/download/jakarta_6.md
new file mode 100644
index 0000000000000000000000000000000000000000..f90ea884783bb850b162641841f7a030e740abf7
--- /dev/null
+++ b/pages/src/content/docs/download/jakarta_6.md
@@ -0,0 +1,5 @@
+---
+title: Servlet 6.1 版本
+description: A reference page in my new Starlight docs site.
+---
+
diff --git a/pages/src/content/docs/download/servlet_4.mdx b/pages/src/content/docs/download/servlet_4.mdx
new file mode 100644
index 0000000000000000000000000000000000000000..66c663b92b892d0dde34ee4260b96d2b4552f7a7
--- /dev/null
+++ b/pages/src/content/docs/download/servlet_4.mdx
@@ -0,0 +1,172 @@
+---
+title: Servlet 4.0 版本
+description: A reference page in my new Starlight docs site.
+---
+import { Aside} from '@astrojs/starlight/components';
+
+
+
+## [smart-servlet v1.4发布(2024-06-01)](https://gitee.com/smartboot/smart-servlet/releases/tag/v1.4)
+
+1. 新增 `HttpSessionIdListener` 规范实现。
+2. 新增 `HttpServletRequest#changeSessionId` 规范实现。
+3. 优化 `ServletContext#getResourcePaths` 规范实现。
+4. 移除 Principal 相关实现。
+5. 调整 `Servlet` 初始化策略,适配 spring 环境。
+
+发版详情:[https://mp.weixin.qq.com/s/9fYcFl0NtjaT7QmWgYkrpA](https://mp.weixin.qq.com/s/9fYcFl0NtjaT7QmWgYkrpA)
+
+## [smart-servlet v1.3发布(2024-05-18)](https://gitee.com/smartboot/smart-servlet/releases/tag/v1.3)
+1. 优化 ServletContext#getMimeType 规范实现。
+2. 优化 ServletContext#addListener 规范实现。
+3. 优化 ServletContext#addServlet 规范实现。
+4. 优化 RequestDispatcher 规范实现。
+5. 优化监听器的启动流程
+6. web.xml 增加 mime-mapping、security-role-ref的解析
+7. favicon 图标更新
+8. smart-http 升级至v1.4.2
+
+## [smart-servlet v1.2发布(2024-05-08)](https://gitee.com/smartboot/smart-servlet/releases/tag/v1.2)
+1. 实现 FilterRegistration#setAsyncSupported 规范。
+2. 实现 ServletRegistration#setAsyncSupported 规范。
+3. 实现 ServletRequest#startAsync 规范。
+4. 实现 ServletContext#getContext 规范。
+5. 优化 HttpServletResponse#sendError 规范实现。
+6. 优化 HttpServletResponse#sendRedirect 规范实现。
+7. 优化 HttpServletResponse#getCharacterEncoding 规范实现。
+8. 优化 HttpServletResponse#setLocale 规范实现。
+9. 优化 ServletOutputStream 实现规范。
+10. SandBox 移除 MemoryPoolProvider。
+11. SandBox 新增 VendorProvider。
+12. SandBox 新增 AsyncContextProvider。
+
+## [smart-servlet v1.1发布(2024-04-14)](https://gitee.com/smartboot/smart-servlet/releases/tag/v1.1)
+1. HttpServletRequestImpl 新增附件接口。
+2. 调整 WebsocketProvider 接口设计,移除onHandShark,新增getWebSocketServerContainer。
+3. 优化 Provider 升级提示文案。
+4. 优化 javax.websocket 规范实现。
+
+## [smart-servlet v0.9发布(2024-02-25)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.9)
+1. 优化 javax.servlet.ServletRequest#getCharacterEncoding 规范实现。
+2. 优化 javax.servlet.ServletResponse#getCharacterEncoding 规范实现。
+3. 实现 javax.servlet.ServletContext#declareRoles 规范。
+4. 实现 javax.servlet.ServletContext#getSessionTimeout 规范。
+5. 实现 javax.servlet.ServletContext#setSessionTimeout 规范。
+6. springboot starter 支持集成 smart-servlet 企业版功能。
+7. 沙箱环境新增 Servlet 关于安全规范的适配。
+
+## [smart-servlet v0.8发布(2024-02-17)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.8)
+1. 修复墨菲安全扫描提示的问题
+2. 支持pem文件的 SSL/TLS 服务。
+
+## [smart-servlet v0.7发布(2024-01-19)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.7)
+1. 优化 ServletResponse#setContentType 规范实现。
+2. 优化 ServletContext#getResourcePaths 规范的实现
+3. 优化输出流的字符集编码处理。
+4. 优化 RequestDispatcher 规范实现。
+5. 升级 smart-http 至 1.3.8
+
+## [smart-servlet v0.6发布(2024-01-11)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.6)
+1. 提供不完整的 AsyncContext 规范实现。
+2. 提供 locale-encoding-mapping-list 规范的实现
+3. 优化 ServletResponse#flushBuffer 规范实现。
+4. 优化 ServletResponse#setLocale 规范实现。
+5. 提供请求异步处理能力。
+6. 新增控制台技术支持信息露出。
+7. 优化日志输出。
+8. 清理大量无用代码。
+
+
+## [smart-servlet v0.5发布(2023-09-28)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.5)
+1. 实现 FilterRegistration#getServletNameMappings 规范。
+2. 实现 ServletContext#getResourcePaths 规范。
+3. 实现 ServletContext#getJspConfigDescriptor 规范。
+4. 实现 ServletContext#requestCharacterEncoding 规范。
+5. 实现 ServletContext#responseCharacterEncoding 规范。
+6. 优化 ServletResponse#setCharacterEncoding 规范实现。
+7. 优化 ServletResponse#getContentType 规范实现。
+8. 优化 ServletResponse#setContentType 规范实现。
+9. 优化 ServletResponse#getOutputStream 规范实现。
+10. 移除 javax.servlet-api,替换为:jakarta.servlet-api:5.0.0。
+11. 移除 javax.annotation-api,替换为:jakarta.annotation-api:2.0.0。
+12. 移除 javax.websocket-api,替换为:jakarta.websocket-api:2.0.0。
+13. 升级 smart-http 至 1.3.1。
+14. 升级 maven-plugin-plugin 至 3.9.0。
+15. 升级 springboot 至 3.0.6。
+
+## [smart-servlet v0.4发布(2023-07-13)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.4)
+1. smart-http升级至1.2.7
+2. 优化ErrorPage规范实现。
+3. 实现AsyncContext规范。
+4. 实现ServletRequest#startAsync规范
+5. 优化HttpServletResponse#addCookie、getCharacterEncoding、setContentType规范实现。
+6. 优化ServletOutputStream#write规范。
+7. 修复ServletRequestDispatcherWrapper#setParameters方法名单词拼写错误问题。
+8. 修复ServletContext#setAttribute中replace情况下的value提取错误问题。
+9. 修复当某个类实现多个Listener接口时,仅其中一个Listener生效的问题。
+
+## [smart-servlet v0.3发布(2023-05-14)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.3)
+1. 实现HttpSessionAttributeListener规范
+2. 实现ServletRequestAttributeListener规范
+3. 实现SessionCookieConfig规范
+4. 实现HttpServletResponse#setLocale、getLocale规范。
+5. 实现 WebListener、WebServlet规范
+6. 支持 Servlet asyncSupported 解析
+7. 支持web-fragment.xml加载
+8. 优化HttpServletResponse规范:Cookie、CharacterEncoding、ContentType。
+9. 优化 Session Cookie.
+10. 优化ServletPrintWriter
+11. 优化Servlet URL匹配算法。
+12. 优化web.xml中url-pattern的解析
+13. 升级smart-http至1.2.1
+14. 升级servlet-api至4.0.1
+15. 升级spring-boot至2.7.11
+16. 引入servlet tck测试套件
+
+## [smart-servlet v0.2.1发布(2023-05-07)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.2.1)
+1. 修复ServletRequest#getServerPort规范实现中的端口解析错误问题。
+2. 升级smart-http至1.2.0。
+3. 实现ServletRequest#isSecure规范。
+4. 优化Websocket的适配策略。
+5. 更新readme中的过时配置。
+
+## [smart-servlet v0.1.9发布(2022-11-23)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.1.9)
+1. 【新特性】实现 servlet 3.1 的文件上传规范。
+2. 【新特性】实现 HttpServletRequest#getRemoteUser 接口规范。
+3. 【新特性】新增War包解压工具。
+4. 【优化】开辟三方依赖存放package,现已集成:bcel、commons-fileupload、commons-io
+5. 【优化】Http响应报文头Server显示:smart-servlet
+6. 【优化】临时文件存放于系统参数 java.io.tmpdir 指定的路径。
+7. 【优化】springboot starter模块禁用 debug 模式。
+
+## [smart-servlet v0.1.8发布(2022-10-30)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.1.8)
+1. 【更新】`smart-servlet-maven-plugin` 和 `smart-servlet-spring-boot-starter` 发布至中央仓库,改善使用体验。
+2. 【更新】原 plugins 模块下的功能合并至 servlet-core,改善使用体验。
+3. 【更新】升级适配的 spring-boot 版本至 `2.7.5`。
+4. 【bugfix】修复发行包初次解压 war 包时加载该容器服务不生效的问题。
+5. 【bugfix】修复`smart-servlet-spring-boot-starter` 启动报错问题。
+
+
+## [smart-servlet v0.1.7发布(2022-10-22)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.1.7)
+1. 调整 dispatcher 插件的启用时机。
+2. 完善 RequestDispatcher#forward 方法的规范实现。
+3. 解析并提取 web.xml 中的 display-name、description 配置信息
+4. 优化 WrappedRuntimeException 的异常传播性。
+5. 降低 default servlet的执行优先级。
+6. 禁用 name=Path 的Cookie。
+7. 实现 ServletRequest#getServerName,ServletRequest#getServerPort 等规范
+8. 改进服务的启动策略。
+9. 优化 smart-servlet-maven-plugin 插件。
+10. springboot starter 支持自定义端口号。
+
+## [smart-servlet v0.1.6发布(2022-10-07)](https://gitee.com/smartboot/smart-servlet/releases/tag/v0.1.6)
+1. 扩展插件功能,添加Servlet容器的注册监听。
+2. 隔离各Servlet容器应用间的缓存资源。
+3. 优化Servlet容器的退出策略。
+4. 运用多线程提升 HandlesTypes 的扫描性能。
+5. smart-servlet maven运行插件添加启动耗时的输出。
+6. Maven 插件 maven-plugin-plugin 升级至 3.6.4
+7. Maven 插件 maven-compiler-plugin 升级至 3.10.1
+8. smart-http 升级至 1.1.16
\ No newline at end of file
diff --git a/pages/src/content/docs/guides/about.mdx b/pages/src/content/docs/guides/about.mdx
new file mode 100644
index 0000000000000000000000000000000000000000..aa2b76aaae7443f9393195c7503dcc0019f971a7
--- /dev/null
+++ b/pages/src/content/docs/guides/about.mdx
@@ -0,0 +1,39 @@
+---
+title: 概述
+sidebar:
+ order: 1
+---
+import { Badge,Aside,LinkCard, CardGrid} from '@astrojs/starlight/components';
+
+smart-servlet 是一个基于 Jakarta Servlet 6.1 的轻量级 Servlet 容器,适用于 Java 21+ 环境。
+
+
+
+## 功能指引
+
+
+
+
+
+
+
+
+## 资源下载
+
+
+
+
+
+
+
+**开源仓库:**
+
+- Github:[https://github.com/smartboot/smart-servlet](https://github.com/smartboot/smart-servlet)
+- Gitee:[https://gitee.com/smartboot/smart-servlet](https://gitee.com/smartboot/smart-servlet)
+
+
+## 目标用户
+- 有着信创需求的企业用户。
+- 对服务并发能力要求高的企业用户。
+- 对技术有着强烈热爱的个人开发者。
\ No newline at end of file
diff --git a/pages/src/content/docs/guides/maven-plugin.md b/pages/src/content/docs/guides/maven-plugin.md
new file mode 100644
index 0000000000000000000000000000000000000000..12e86b9c6f7574aa6031b8d53296ce0ff833f443
--- /dev/null
+++ b/pages/src/content/docs/guides/maven-plugin.md
@@ -0,0 +1,28 @@
+---
+title: Maven 插件
+sidebar:
+ order: 2
+---
+
+这是一种类似:`tomcat-maven-plugin`的使用方式,通常应用于 Java Web 工程的本地开发环境。
+集成该插件只需在 pom.xml 中加入以下代码,便可以在 IDE 中启动 servlet 服务。
+```xml
+
+
+
+ tech.smartboot.jakarta
+ smart-servlet-maven-plugin
+ ${最新版本号}
+
+ 8080
+ /
+
+
+
+
+```
+插件的版本建议采用最新版本,另外主要的配置项包括:
+- port:servlet服务启动的监听端口
+- path:Servlet容器上下文路径,即 ContextPath,通常以`/`表示。当然也支持自定义,但必须以`/`开头
+
+完成配置后在控制台输入:`mvn package smart-servlet:run`即可。
diff --git a/pages/src/content/docs/guides/springboot.md b/pages/src/content/docs/guides/springboot.md
new file mode 100644
index 0000000000000000000000000000000000000000..8e0b6d2cc3137fb484858bc060200c0a3d755528
--- /dev/null
+++ b/pages/src/content/docs/guides/springboot.md
@@ -0,0 +1,81 @@
+---
+title: Springboot 部署
+date: 2022-12-04 16:44:58
+permalink: /smart-servlet/springboot.html
+article: false
+---
+
+用过 springboot 的 spring-boot-starter-tomcat 或者 spring-boot-starter-undertow 的朋友应该对此不陌生。
+
+smart-servlet-spring-boot-starter 本质上就是 smart-servlet 对 spring-boot-starter-web 的另一种适配。
+
+只需按照以下方式调整 springboot 工程中 pom.xml 文件的配置,便可将 springboot 的默认 Servlet 容器替换成 smart-servlet。
+
+```xml
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+
+ org.smartboot.servlet
+ smart-servlet-spring-boot-starter
+ ${最新版本号}
+
+
+```
+#### 企业版集成
+springboot 的企业版在集成上相较于开源版会多出一些额外的步骤。
+
+因为所依赖的企业版 jar 包没有开源,也没有发布到 maven 中央仓库。
+用户需要通过官方渠道获取相应的资源包,再导入至本地工程中完成 smart-servlet 企业版的集成。
+
+**步骤一:**
+
+获取 springboot 资源包 **smart-servlet-springboot-${version}.tar.gz** 并解压。
+解压后的目录内容如下:
+
+
+**步骤二:**
+
+拷贝资源文件至你的 springboot 工程内。具体如下:
+- lib 目录:拷贝至 springboot 工程目录下。
+- smart-servlet 目录:拷贝至 springboot 工程的 `src/main/resources` 路径下。
+
+**步骤三:**
+修改springboot工程内的pom.xml文件,添加如下配置:
+```xml
+
+ org.smartboot.servlet
+ base
+ 1.0
+ system
+ ${pom.basedir}/lib/base-1.2.jar
+
+```
+另外,需要在 springboot 打包插件`spring-boot-maven-plugin`中添加配置:`includeSystemScope`,
+该配置的作用是在打可执行jar包时,将 smart-servlet 企业版的依赖包也包含进去。
+```xml
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ true
+
+
+
+
+```
+**自此,便完成了 smart-servlet 企业版的集成。**
+
diff --git a/pages/src/content/docs/guides/tar.md b/pages/src/content/docs/guides/tar.md
new file mode 100644
index 0000000000000000000000000000000000000000..3d88ed29eb200e8c5454f2ac8a839265aacf8697
--- /dev/null
+++ b/pages/src/content/docs/guides/tar.md
@@ -0,0 +1,7 @@
+---
+title: War 包部署
+date: 2022-12-04 16:44:58
+permalink: /smart-servlet/war.html
+article: false
+---
+
diff --git a/pages/src/content/docs/index.mdx b/pages/src/content/docs/index.mdx
new file mode 100644
index 0000000000000000000000000000000000000000..ee09e9bcd03b6cba3d2833f6f3dacc2e39fb5d7c
--- /dev/null
+++ b/pages/src/content/docs/index.mdx
@@ -0,0 +1,37 @@
+---
+title: smart-servlet
+description: 真自研、真轻量、真极速的 Servlet 容器.
+template: splash
+hero:
+ tagline: 自研、轻量、极速,重新定义 Servlet 容器!
+ image:
+ file: ../../assets/houston.webp
+ actions:
+ - text: 产品手册
+ link: ./guides/about/
+ icon: right-arrow
+ variant: primary
+ - text: 下载最新版
+ link: /smart-servlet/download/jakarta_6/
+ icon: external
+---
+
+import { Card, CardGrid } from '@astrojs/starlight/components';
+
+
+## 特性
+
+
+
+ 分别适配 `javax-servlet 4.0` 及 `jakarta-servlet 6.1`,涵盖 Java 8~21 应用场景。
+
+
+ 做性能最强的、体积最小的 Servlet 容器。轻松实现十万级QPS,重新定义 Web 速度。
+
+
+ 嵌入式集成、动静混合部署、自定义 SPI、轻松实现业务扩展。
+
+
+ 时代需要的不再仅仅是一个 web 服务器。并发稳定性、数据安全性、服务可靠性,由我来守护。
+
+
diff --git a/pages/src/content/docs/performance/ab_smart-servlet.jpeg b/pages/src/content/docs/performance/ab_smart-servlet.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..83f5c22600b5ea9cf38cb0f2a60a5bdc2d7dc463
Binary files /dev/null and b/pages/src/content/docs/performance/ab_smart-servlet.jpeg differ
diff --git a/pages/src/content/docs/performance/ab_smart-servlet_1000.jpeg b/pages/src/content/docs/performance/ab_smart-servlet_1000.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..d4e84b47702671455f06079e594a90d0cc4accd9
Binary files /dev/null and b/pages/src/content/docs/performance/ab_smart-servlet_1000.jpeg differ
diff --git a/pages/src/content/docs/performance/ab_smart-servlet_150.jpeg b/pages/src/content/docs/performance/ab_smart-servlet_150.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..7193ee0ec6ba4fee22178069fd0513498d1c3ffd
Binary files /dev/null and b/pages/src/content/docs/performance/ab_smart-servlet_150.jpeg differ
diff --git a/pages/src/content/docs/performance/ab_tomcat.jpeg b/pages/src/content/docs/performance/ab_tomcat.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..6623a30c435e5a52355efd9567f778899a66f3ba
Binary files /dev/null and b/pages/src/content/docs/performance/ab_tomcat.jpeg differ
diff --git a/pages/src/content/docs/performance/ab_tomcat_150.jpeg b/pages/src/content/docs/performance/ab_tomcat_150.jpeg
new file mode 100644
index 0000000000000000000000000000000000000000..aeef511fd226cd0b93953f15aba3b5532a4831bb
Binary files /dev/null and b/pages/src/content/docs/performance/ab_tomcat_150.jpeg differ
diff --git a/pages/src/content/docs/performance/test-data.md b/pages/src/content/docs/performance/test-data.md
new file mode 100644
index 0000000000000000000000000000000000000000..377edfe3d1fd8c1f99652cec3ec450e75688dfac
--- /dev/null
+++ b/pages/src/content/docs/performance/test-data.md
@@ -0,0 +1,104 @@
+---
+title: test-data
+date: 2022-10-27 12:36:13
+permalink: /pages/c9f9df/
+---
+# 评测数据
+
+## 一、测试结果
+
+| 规范清单 | Tomcat 9 | smart-servlet |
+| ------------ | -------- | ------------- |
+| Servlet Spec | 4.0 | 3.1 |
+| Jsp Spec | 2.3 | N/A |
+
+在相同的测试工程下:
+
+- smart-servlet 性能表现结果比 tomcat 高出 50%~100 以上 。
+- tomcat 压测期间 CPU 使用率高于 40%,smart-servlet 压测时低于 40% 。
+- tomcat 线程数随并发数递增,上限 200;smart-servlet 线程数固定,不受并发数影响 。
+- 内存开销两者基本持平。
+
+> 评测在不同的测试方式、测试环境下会有不同的表现。本文结论仅供参考,请以自己的实际测试结果为准。
+
+## 二、压测过程
+
+测试方式:先执行 3 次压测,使服务器完成预热,每次压测前都确保端口充分释放。
+
+### 2.1 ApacheBench 压测
+
+#### 2.1.1 并发量:100
+
+**测试命令**
+
+```shell
+ab -k -c100 -t 10 http://127.0.0.1:8080/examples/servlets/servlet/HelloWorldExample
+```
+
+**测试结果**
+
+| tomcat / smart-servlet | Requests per second [count/sec] | Transfer rate [Kbytes/sec] | 累计YGC | 累计FGC |
+| ---------------------- | ------------------------------- | -------------------------- | ------- | ------- |
+| 第 1 轮 | 18536.55 / 37129.34 | 11689.08 / 22806.99 | 18 / 22 | 1 / 0 |
+| 第 2 轮 | 21194.69 / 32753.81 | 13365.34 / 20119.28 | 23 / 28 | 1 / 0 |
+| 第 3 轮 | 22588.81 / 36523.28 | 14244.43 / 22434.71 | 27 / 34 | 1 / 0 |
+| 第 4 轮 | 20171.81 / 35668.17 | 12720.25 / 21909.45 | 32 / 42 | 1 / 0 |
+| 第 5 轮 | 21957.96 / 30439.92 | 13846.64 / 18697.96 | 37 / 52 | 1 / 0 |
+
+**压测小结:**
+
+- 从 ab 产生的结果来看 smart-servlet 的性能比 tomcat 高出 50%~100% 。
+- 而且从下图可以看到压测期间 tomcat 线程数增长至 118,而 smart-servlet 始终稳定在 23。
+- tomcat 不能很好的支持 http1.0 keep-alive。ab采用了的协议是 Http1.0,压测 tomcat 过程中发现实际建立的连接数超过了500个,而 smart-servlet 稳定在100个。
+
+
+
+
+
+#### 2.1.2 并发量:150
+
+**测试命令**
+
+```shell
+ab -k -c150 -t 10 -r http://127.0.0.1:8080/examples/servlets/servlet/HelloWorldExample
+```
+
+**测试结果**
+
+| Tomcat / smart-servlet | Requests per second [count/sec] | Transfer rate [Kbytes/sec] | 累计YGC | 累计FGC |
+| ---------------------- | ------------------------------- | -------------------------- | ------- | ------- |
+| 第 1 轮 | 18402.97 / 40874.22 | 11605.02 / 25107.31 | 30 / 16 | 1 / 0 |
+| 第 2 轮 | 25367.06 / 45381.93 | 15996.65 / 27876.21 | 37 / 19 | 1 / 0 |
+| 第 3 轮 | 25935.43 / 41616.07 | 16355.01 / 25563.00 | 44 / 21 | 1 / 0 |
+| 第 4 轮 | 26399.91 / 44049.76 | 16647.90 / 27057.91 | 52 / 25 | 1 / 0 |
+| 第 5 轮 | 24079.55 / 49325.96 | 15184.70 / 30298.86 | 61 / 29 | 1 / 0 |
+
+**压测小结:**
+
+- 在 150 的并发下 smart-servlet 的性能比 tomcat 高出 50%~100% 。
+- tomcat 线程数增长值 169,smart-servlet 维持23个不变。
+
+
+
+
+
+#### 2.1.3 并发量:1000
+
+**测试命令**
+
+```shell
+ab -k -c1000 -t 10 -r http://127.0.0.1:8080/examples/servlets/servlet/HelloWorldExample
+```
+
+**测试结果**
+
+| smart-servlet | Requests per second [count/sec] | Transfer rate [Kbytes/sec] | 累计YGC | 累计FGC |
+| ------------- | ------------------------------- | -------------------------- | ------- | ------- |
+| 第 1 轮 | 37633.03 | 23116.38 | 15 | 0 |
+| 第 2 轮 | 35776.23 | 21975.83 | 17 | 0 |
+| 第 3 轮 | 39916.91 | 24519.27 | 19 | 0 |
+| 第 4 轮 | 38895.61 | 23891.93 | 21 | 0 |
+| 第 5 轮 | 39318.90 | 24151.94 | 22 | 0 |
+
+压测小结:在此并发量下 tomcat 失败率太高,不再进行评测。
+
diff --git a/pages/src/content/docs/reference/license.mdx b/pages/src/content/docs/reference/license.mdx
new file mode 100644
index 0000000000000000000000000000000000000000..3dfd49f74191bd2d46fd4a4482a9f58f3548fdf1
--- /dev/null
+++ b/pages/src/content/docs/reference/license.mdx
@@ -0,0 +1,207 @@
+---
+title: 商业授权
+---
+import { Badge,Card,LinkCard, CardGrid} from '@astrojs/starlight/components';
+
+## 许可证
+我们持续增强 smart-servlet 的核心能力并保持开源,希望可以满足大多数小企业的需求。
+
+当你的企业在商业模式和技术支持等方面有更高要求时,可以选择商业许可证和商业插件。
+
+
+
+
+ |
+开源版 |
+商业版 |
+企业版 |
+
+
+
+
+价格 |
+免费 |
+联系我们 |
+联系我们 |
+
+
+许可证 |
+
+
+许可证类型 |
+AGPL 3.0 |
+商业许可证 |
+企业许可证 |
+
+
+永久授权 |
+✔ |
+年订阅制 |
+✔ |
+
+
+授权版本 |
+全部 |
+全部 |
+一个根版本 |
+
+
+授权范围 |
+
+
+smart-servlet内核 |
+✔ |
+✔ |
+✔ |
+
+
+开源插件 |
+✔ |
+✔ |
+✔ |
+
+
+商业插件 |
+❌ |
+✔ |
+✔ |
+
+
+使用限制 |
+
+
+适配 springboot |
+✔ |
+✔ |
+✔ |
+
+
+maven 插件 |
+✔ |
+✔ |
+✔ |
+
+
+Session 安全性 |
+低 |
+高 |
+高 |
+
+
+向客户分发 smart-servlet |
+❌ |
+❌ |
+✔ |
+
+
+支持 |
+
+
+社区支持 |
+✔ |
+✔ |
+✔ |
+
+
+专属和及时的 bug 修复 |
+❌ |
+✔ |
+✔ |
+
+
+专属的使用咨询 |
+❌ |
+✔ |
+✔ |
+
+
+专属的扩展开发咨询 |
+❌ |
+✔ |
+✔ |
+
+
+优先排期新功能 |
+❌ |
+❌ |
+✔ |
+
+
+定制插件 |
+❌ |
+❌ |
+✔ |
+
+
+
+
+
+## 常见问题
+
+ 购买商业许可证获得的功能与开源版本的功能有区别吗?
+ 没有。商业许可证与开源许可证对应的代码完全相同。
+
+ smart-servlet 采用 AGPL-3.0 与商业许可双重授权,你可以根据自己的需求来选择许可证类型。
+
+
+
+ 是否要购买商业许可证才能用在商业环境?
+ 不是。smart-servlet 的内核和开源插件是 AGPL 3.0 协议,
+ 只要你遵循协议,并且保留 smart-servlet 版权信息和版本信息,就可以免费使用。
+
+
+
+
+
+ 什么情况下需要购买商业许可证?
+ 如果你有以下任何需求,则需要购买商业许可证:
+
+ - 对 smart-servlet 的代码做了更改,或者扩展了自己的插件,但你不想将这些产出物以 AGPL 协议开源
+ - 将 smart-servlet 集成到你的产品中,但不想将自己的产品以 AGPL 协议开源
+ - 你希望获得 smart-servlet 团队的高级技术支持
+
+
+
+ 如何理解“永久授权”?
+ 没有过期时间,不需要按年付费,一旦你购买了商业许可证或者商业插件,就会获得当前根版本的永久授权,可以永久使用。
+
+
+
+ 什么是“根版本”?
+ 商业许可证和商业插件的许可范围为一个根版本,比如从 1.0 至 1.x 均获得授权。
+
+ 当需要跨根版本升级的时候,比如从 1.x 升级到 2.x,可以以 50% 折扣价格购买。
+
+
+
+
+ 商业授权和商业插件的高级技术支持有效期是多久?
+ 技术支持有效期为 6 个月。
+
+ 我们相信在这段时间内你的团队可以完全掌握该版本的使用,并验证该版本是否满足你的需求。
+
+
+
+ 商业版可以试用吗?
+ 可以。
+
+ 联系我们可获得运行时有效期 30 分钟的商业版。
+
+
+
+ smart-servlet 支持 javax-servlet 吗?
+ 支持定制化服务。
+
+ smart-servlet 起初便是源于 javax-servlet 4.0 规范。结合 smart-servlet 自身的产品定位,继续投入 javax-servlet 不利于项目发展。
+
+ 若有这方面需求的客户,可以尝试走定制化服务。
+
+
+
+
+
+
+## 如何购买
+通过邮件或微信联系我们,与我们的核心团队探讨方案,获得独家支持。
+
+[联系我们](/service.html#联系方式)
\ No newline at end of file
diff --git a/pages/src/env.d.ts b/pages/src/env.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..acef35f175aae528d22fdc6b91e819aa52837fd9
--- /dev/null
+++ b/pages/src/env.d.ts
@@ -0,0 +1,2 @@
+///
+///
diff --git a/pages/tsconfig.json b/pages/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..bcbf8b50906a72a17cb6578418123daad8ad375d
--- /dev/null
+++ b/pages/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "extends": "astro/tsconfigs/strict"
+}
diff --git a/pom.xml b/pom.xml
index ba035948814510f050c528d6f75d31a0d4e1c022..54b54f77b4e256d7d547c4e68408deefa2a61504 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,13 +3,13 @@
smart-servlet-parent
a lightweight servlet container
4.0.0
- org.smartboot.servlet
+ tech.smartboot.jakarta
smart-servlet-parent
1.5
pom
- 1.5.2
+ 1.5.5
1.5
UTF-8
@@ -31,25 +31,10 @@
- org.smartboot.servlet
+ tech.smartboot.jakarta
servlet-core
${smartservlet.version}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
http://git.oschina.net/smartboot/smart-servlet
@@ -112,8 +97,8 @@
org.apache.maven.plugins
maven-compiler-plugin
- 1.8
- 1.8
+ 17
+ 17
UTF-8
diff --git a/servlet-core/pom.xml b/servlet-core/pom.xml
index a8d710abe6edf957a26c9e21064ae89d6785d6b0..4be531043d89670b9350fb19765515d9dc0b50bb 100644
--- a/servlet-core/pom.xml
+++ b/servlet-core/pom.xml
@@ -14,7 +14,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
smart-servlet-parent
- org.smartboot.servlet
+ tech.smartboot.jakarta
1.5
servlet-core
@@ -30,40 +30,32 @@
smart-http-server
-
-
-
-
-
-
-
-
-
-
-
-
-
- javax.servlet
- javax.servlet-api
- 4.0.1
+ jakarta.servlet
+ jakarta.servlet-api
+ 6.0.0
- javax.annotation
- javax.annotation-api
- 1.3.2
+ jakarta.annotation
+ jakarta.annotation-api
+ 2.1.1
- javax.websocket
- javax.websocket-api
- 1.1
+ jakarta.websocket
+ jakarta.websocket-api
+ 2.1.1
+
+
+ jakarta.websocket
+ jakarta.websocket-client-api
+ 2.1.1
-
-
-
-
-
+
+ org.mortbay.jasper
+ apache-jsp
+ 10.1.5
+
\ No newline at end of file
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/plugins/websocket/impl/HandshakeResponseImpl.java b/servlet-core/src/main/java/org/smartboot/servlet/plugins/websocket/impl/HandshakeResponseImpl.java
deleted file mode 100644
index c4ab0c721dd8fe3f97693c276c429374166619a9..0000000000000000000000000000000000000000
--- a/servlet-core/src/main/java/org/smartboot/servlet/plugins/websocket/impl/HandshakeResponseImpl.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.smartboot.servlet.plugins.websocket.impl;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.websocket.HandshakeResponse;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-public class HandshakeResponseImpl implements HandshakeResponse {
- public HandshakeResponseImpl(HttpServletResponse response) {
-
- }
-
- @Override
- public Map> getHeaders() {
- return Collections.emptyMap();
- }
-}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/third/bcel/classfile/ClassFormatException.java b/servlet-core/src/main/java/org/smartboot/servlet/third/bcel/classfile/ClassFormatException.java
deleted file mode 100644
index ea4fef005dd25cd71f2a32ba5756824933a72a0d..0000000000000000000000000000000000000000
--- a/servlet-core/src/main/java/org/smartboot/servlet/third/bcel/classfile/ClassFormatException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.smartboot.servlet.third.bcel.classfile;
-
-/**
- * Thrown when the BCEL attempts to read a class file and determines
- * that the file is malformed or otherwise cannot be interpreted as a
- * class file.
- */
-public class ClassFormatException extends RuntimeException {
-
- private static final long serialVersionUID = 3243149520175287759L;
-
- public ClassFormatException() {
- super();
- }
-
-
- public ClassFormatException(final String s) {
- super(s);
- }
-}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/Closeable.java b/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/Closeable.java
deleted file mode 100644
index b8338ebb7643f03a0147470b73aac78afd928cb6..0000000000000000000000000000000000000000
--- a/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/Closeable.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.smartboot.servlet.third.commons.fileupload.util;
-
-import java.io.IOException;
-
-/**
- * Interface of an object, which may be closed.
- */
-public interface Closeable {
-
- /**
- * Closes the object.
- *
- * @throws IOException An I/O error occurred.
- */
- void close() throws IOException;
-
- /**
- * Returns, whether the object is already closed.
- *
- * @return True, if the object is closed, otherwise false.
- * @throws IOException An I/O error occurred.
- */
- boolean isClosed() throws IOException;
-
-}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/mime/ParseException.java b/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/mime/ParseException.java
deleted file mode 100644
index dfedad00ebd145968903d7466c35dfab91d0dcda..0000000000000000000000000000000000000000
--- a/servlet-core/src/main/java/org/smartboot/servlet/third/commons/fileupload/util/mime/ParseException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.smartboot.servlet.third.commons.fileupload.util.mime;
-
-/**
- * @since 1.3
- */
-final class ParseException extends Exception {
-
- /**
- * The UID to use when serializing this instance.
- */
- private static final long serialVersionUID = 5355281266579392077L;
-
- /**
- * Constructs a new exception with the specified detail message.
- *
- * @param message the detail message.
- */
- public ParseException(String message) {
- super(message);
- }
-
-}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/AnnotationsLoader.java b/servlet-core/src/main/java/tech/smartboot/jakarta/AnnotationsLoader.java
similarity index 84%
rename from servlet-core/src/main/java/org/smartboot/servlet/AnnotationsLoader.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/AnnotationsLoader.java
index d7e6fd5b506fd5379063fd6c2124313c9b8f958e..0cbb6bd433984bebb6ca797d97bbabd0115a7c26 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/AnnotationsLoader.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/AnnotationsLoader.java
@@ -8,21 +8,27 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
-
+package tech.smartboot.jakarta;
+
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.ServletContainerInitializer;
+import jakarta.servlet.annotation.HandlesTypes;
+import jakarta.servlet.annotation.WebFilter;
+import jakarta.servlet.annotation.WebInitParam;
+import jakarta.servlet.annotation.WebListener;
+import jakarta.servlet.annotation.WebServlet;
import org.smartboot.http.common.utils.StringUtils;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.third.bcel.Const;
-import org.smartboot.servlet.third.bcel.classfile.AnnotationEntry;
-import org.smartboot.servlet.third.bcel.classfile.ClassParser;
-import org.smartboot.servlet.third.bcel.classfile.JavaClass;
-import org.smartboot.servlet.util.CollectionUtils;
-
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.annotation.HandlesTypes;
-import javax.servlet.annotation.WebInitParam;
-import javax.servlet.annotation.WebListener;
-import javax.servlet.annotation.WebServlet;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.FilterMappingInfo;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.enums.FilterMappingType;
+import tech.smartboot.jakarta.third.bcel.Const;
+import tech.smartboot.jakarta.third.bcel.classfile.AnnotationEntry;
+import tech.smartboot.jakarta.third.bcel.classfile.ClassParser;
+import tech.smartboot.jakarta.third.bcel.classfile.JavaClass;
+import tech.smartboot.jakarta.util.CollectionUtils;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -31,6 +37,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
@@ -70,9 +77,10 @@ public class AnnotationsLoader {
*/
private boolean handlesTypesNonAnnotations = false;
- private Map> annotations = new HashMap<>();
+ private final Map> annotations = new HashMap<>();
private final Map servlets = new HashMap<>();
+ private final Map filters = new HashMap<>();
public AnnotationsLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
@@ -138,6 +146,10 @@ public class AnnotationsLoader {
return servlets;
}
+ public Map getFilters() {
+ return filters;
+ }
+
public List getAnnotations(Class clazz) {
List classes = annotations.get(clazz);
return CollectionUtils.isEmpty(classes) ? Collections.emptyList() : classes;
@@ -211,6 +223,36 @@ public class AnnotationsLoader {
String annotationName = getClassName(entry.getAnnotationType());
if (WebListener.class.getName().equals(annotationName)) {
annotations.computeIfAbsent(WebListener.class, aClass -> new ArrayList<>()).add(className);
+ } else if (WebFilter.class.getName().equals(annotationName)) {
+ Class> clazz = classLoader.loadClass(className);
+ WebFilter webFilter = clazz.getAnnotation(WebFilter.class);
+ String name = webFilter.filterName();
+ if (StringUtils.isBlank(name)) {
+ name = className;
+ }
+ FilterInfo filterInfo = new FilterInfo();
+ filterInfo.setFilterName(name);
+ filterInfo.setFilterClass(className);
+ filterInfo.setAsyncSupported(webFilter.asyncSupported());
+ for (WebInitParam param : webFilter.initParams()) {
+ filterInfo.addInitParam(param.name(), param.value());
+ }
+ Set set = new HashSet<>(Arrays.asList(webFilter.dispatcherTypes()));
+ for (String urlPattern : webFilter.urlPatterns()) {
+ FilterMappingInfo filterMappingInfo =
+ new FilterMappingInfo(name,
+ FilterMappingType.URL, null, PathMatcherUtil.addMapping(urlPattern),
+ set);
+ filterInfo.addMapping(filterMappingInfo);
+ }
+ for (String servletName : webFilter.servletNames()) {
+ FilterMappingInfo filterMappingInfo =
+ new FilterMappingInfo(name,
+ FilterMappingType.SERVLET, servletName, null,
+ set);
+ filterInfo.addMapping(filterMappingInfo);
+ }
+ filters.put(name, filterInfo);
} else if (WebServlet.class.getName().equals(annotationName)) {
Class> clazz = classLoader.loadClass(className);
WebServlet webServlet = clazz.getAnnotation(WebServlet.class);
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/Container.java b/servlet-core/src/main/java/tech/smartboot/jakarta/Container.java
similarity index 90%
rename from servlet-core/src/main/java/org/smartboot/servlet/Container.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/Container.java
index e10d124a7ad87e4526c33a1e9dd4200070ba5cf7..21ad8e8acdcceae673806f5eab6c006a453fd3b2 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/Container.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/Container.java
@@ -8,8 +8,12 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
+package tech.smartboot.jakarta;
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.ServletContainerInitializer;
+import jakarta.servlet.ServletResponse;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
import org.smartboot.http.common.utils.StringUtils;
@@ -18,24 +22,21 @@ import org.smartboot.http.server.HttpResponse;
import org.smartboot.http.server.HttpServerConfiguration;
import org.smartboot.http.server.WebSocketRequest;
import org.smartboot.http.server.WebSocketResponse;
-import org.smartboot.servlet.conf.DeploymentInfo;
-import org.smartboot.servlet.conf.WebAppInfo;
-import org.smartboot.servlet.exception.WrappedRuntimeException;
-import org.smartboot.servlet.handler.FilterMatchHandler;
-import org.smartboot.servlet.handler.HandlerContext;
-import org.smartboot.servlet.handler.HandlerPipeline;
-import org.smartboot.servlet.handler.ServletMatchHandler;
-import org.smartboot.servlet.handler.ServletRequestListenerHandler;
-import org.smartboot.servlet.handler.ServletServiceHandler;
-import org.smartboot.servlet.impl.HttpServletRequestImpl;
-import org.smartboot.servlet.impl.HttpServletResponseImpl;
-import org.smartboot.servlet.impl.ServletContextImpl;
-import org.smartboot.servlet.plugins.Plugin;
-
-import javax.servlet.AsyncContext;
-import javax.servlet.DispatcherType;
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.ServletResponse;
+import tech.smartboot.jakarta.conf.DeploymentInfo;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.WebAppInfo;
+import tech.smartboot.jakarta.exception.WrappedRuntimeException;
+import tech.smartboot.jakarta.handler.FilterMatchHandler;
+import tech.smartboot.jakarta.handler.HandlerContext;
+import tech.smartboot.jakarta.handler.HandlerPipeline;
+import tech.smartboot.jakarta.handler.ServletMatchHandler;
+import tech.smartboot.jakarta.handler.ServletRequestListenerHandler;
+import tech.smartboot.jakarta.handler.ServletServiceHandler;
+import tech.smartboot.jakarta.impl.HttpServletRequestImpl;
+import tech.smartboot.jakarta.impl.HttpServletResponseImpl;
+import tech.smartboot.jakarta.impl.ServletContextImpl;
+import tech.smartboot.jakarta.plugins.Plugin;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -64,7 +65,14 @@ public class Container {
* http://patorjk.com/software/taag/
* Font Name: Puffy
*/
- private static final String BANNER = " _ _ _ \n" + " ( )_ (_ ) ( )_ \n" + " ___ ___ ___ _ _ _ __ | ,_) ___ __ _ __ _ _ | | __ | ,_)\n" + "/',__)/' _ ` _ `\\ /'_` )( '__)| | /',__) /'__`\\( '__)( ) ( ) | | /'__`\\| | \n" + "\\__, \\| ( ) ( ) |( (_| || | | |_ \\__, \\( ___/| | | \\_/ | | | ( ___/| |_ \n" + "(____/(_) (_) (_)`\\__,_)(_) `\\__) (____/`\\____)(_) `\\___/'(___)`\\____)`\\__)";
+ private static final String BANNER = """
+ _ _____ _ _ \s
+ ( )_ (___ ) ( ) ( )_ \s
+ ___ ___ ___ _ _ _ __ | ,_) | | _ _ | |/') _ _ _ __ | ,_) _ _\s
+ /',__)/' _ ` _ `\\ /'_` )( '__)| | _ | | /'_` )| , < /'_` )( '__)| | /'_` )
+ \\__, \\| ( ) ( ) |( (_| || | | |_ ( )_| |( (_| || |\\`\\ ( (_| || | | |_ ( (_| |
+ (____/(_) (_) (_)`\\__,_)(_) `\\__) `\\___/'`\\__,_)(_) (_)`\\__,_)(_) `\\__)`\\__,_)
+ """;
public static final String VERSION = "v1.5";
/**
* 注册在当前 Servlet 容器中的运行环境
@@ -317,7 +325,9 @@ public class Container {
webAppInfo.getErrorPages().forEach(deploymentInfo::addErrorPage);
//register Filter
- webAppInfo.getFilters().values().forEach(deploymentInfo::addFilter);
+ for (FilterInfo filterInfo : webAppInfo.getFilters().values()) {
+ deploymentInfo.addFilter(filterInfo);
+ }
//register servletContext into deploymentInfo
webAppInfo.getContextParams().forEach(deploymentInfo::addInitParameter);
@@ -325,9 +335,6 @@ public class Container {
webAppInfo.getListeners().forEach(listener -> servletRuntime.getServletContext().addListener(listener));
deploymentInfo.setDynamicListenerState(true);
- //register filterMapping into deploymentInfo
- webAppInfo.getFilterMappings().forEach(deploymentInfo::addFilterMapping);
-
webAppInfo.getLocaleEncodingMappings().forEach(deploymentInfo::addLocaleEncodingMapping);
webAppInfo.getMimeMappings().forEach((key, value) -> servletRuntime.getServletContext().putMimeTypes(key, value));
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/DefaultServlet.java b/servlet-core/src/main/java/tech/smartboot/jakarta/DefaultServlet.java
similarity index 95%
rename from servlet-core/src/main/java/org/smartboot/servlet/DefaultServlet.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/DefaultServlet.java
index 4f05d88cd2befd5d70b23c225eb1126859800334..df95a307223b4092d8f4fa3e7e19530d0bed19c4 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/DefaultServlet.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/DefaultServlet.java
@@ -8,7 +8,7 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
+package tech.smartboot.jakarta;
import org.smartboot.http.common.enums.HeaderNameEnum;
@@ -18,16 +18,16 @@ import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
import org.smartboot.http.common.utils.Mimetypes;
import org.smartboot.http.common.utils.StringUtils;
-import org.smartboot.servlet.conf.DeploymentInfo;
-import org.smartboot.servlet.exception.WrappedRuntimeException;
-
-import javax.servlet.DispatcherType;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import tech.smartboot.jakarta.conf.DeploymentInfo;
+import tech.smartboot.jakarta.exception.WrappedRuntimeException;
+
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/ServletContextRuntime.java b/servlet-core/src/main/java/tech/smartboot/jakarta/ServletContextRuntime.java
similarity index 91%
rename from servlet-core/src/main/java/org/smartboot/servlet/ServletContextRuntime.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/ServletContextRuntime.java
index 86f64849ffe44e74200fc9badba1e24e319bc41b..0ff1a0f4a3154113644544aea421fa8af1796402 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/ServletContextRuntime.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/ServletContextRuntime.java
@@ -8,34 +8,34 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
-
+package tech.smartboot.jakarta;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterConfig;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletContextEvent;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebListener;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
import org.smartboot.http.common.utils.StringUtils;
-import org.smartboot.servlet.conf.DeploymentInfo;
-import org.smartboot.servlet.conf.FilterInfo;
-import org.smartboot.servlet.conf.ServletContainerInitializerInfo;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.impl.FilterConfigImpl;
-import org.smartboot.servlet.impl.ServletContextImpl;
-import org.smartboot.servlet.impl.ServletContextWrapperListener;
-import org.smartboot.servlet.plugins.Plugin;
-import org.smartboot.servlet.provider.AsyncContextProvider;
-import org.smartboot.servlet.provider.DispatcherProvider;
-import org.smartboot.servlet.provider.FaviconProvider;
-import org.smartboot.servlet.provider.SessionProvider;
-import org.smartboot.servlet.provider.VendorProvider;
-import org.smartboot.servlet.provider.WebsocketProvider;
-import org.smartboot.servlet.sandbox.SandBox;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebListener;
+import tech.smartboot.jakarta.conf.DeploymentInfo;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.ServletContainerInitializerInfo;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.impl.FilterConfigImpl;
+import tech.smartboot.jakarta.impl.ServletContextImpl;
+import tech.smartboot.jakarta.impl.ServletContextWrapperListener;
+import tech.smartboot.jakarta.plugins.Plugin;
+import tech.smartboot.jakarta.provider.AsyncContextProvider;
+import tech.smartboot.jakarta.provider.DispatcherProvider;
+import tech.smartboot.jakarta.provider.FaviconProvider;
+import tech.smartboot.jakarta.provider.SessionProvider;
+import tech.smartboot.jakarta.provider.VendorProvider;
+import tech.smartboot.jakarta.provider.WebsocketProvider;
+import tech.smartboot.jakarta.sandbox.SandBox;
+
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -219,6 +219,9 @@ public class ServletContextRuntime {
deploymentInfo.addServlet(servletInfo);
}
});
+ deploymentInfo.getHandlesTypesLoader().getFilters().values().forEach(filterInfo -> {
+ deploymentInfo.addFilter(filterInfo);
+ });
deploymentInfo.getHandlesTypesLoader().clear();
deploymentInfo.setHandlesTypesLoader(null);
// System.out.println("scanHandleTypes use :" + (System.currentTimeMillis() - start));
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/SmartHttpServletRequest.java b/servlet-core/src/main/java/tech/smartboot/jakarta/SmartHttpServletRequest.java
similarity index 81%
rename from servlet-core/src/main/java/org/smartboot/servlet/SmartHttpServletRequest.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/SmartHttpServletRequest.java
index 9646a398e8c74c5a2c03ee470c730d41b665574c..74c4f085a28920b22902c2099f0f090a20e454a1 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/SmartHttpServletRequest.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/SmartHttpServletRequest.java
@@ -8,12 +8,13 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
+package tech.smartboot.jakarta;
-import org.smartboot.servlet.conf.ServletInfo;
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.HttpServletRequest;
import org.smartboot.socket.util.Attachment;
-
-import javax.servlet.http.HttpServletRequest;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.conf.ServletMappingInfo;
/**
* @author 三刀
@@ -53,4 +54,6 @@ public interface SmartHttpServletRequest extends HttpServletRequest {
* @param attachment 附件对象
*/
void setAttachment(Attachment attachment);
+
+ void setServletMappingInfo(ServletMappingInfo servletMappingInfo);
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/WebSocketServerContainer.java b/servlet-core/src/main/java/tech/smartboot/jakarta/WebSocketServerContainer.java
similarity index 50%
rename from servlet-core/src/main/java/org/smartboot/servlet/WebSocketServerContainer.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/WebSocketServerContainer.java
index c3a635bf90222027325d83b6a8806e2d7581c0a1..e0bd0e63b019aac66bd258ce1debd7b5ff1d2530 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/WebSocketServerContainer.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/WebSocketServerContainer.java
@@ -8,17 +8,17 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
+package tech.smartboot.jakarta;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.websocket.Endpoint;
-import javax.websocket.server.ServerContainer;
-import javax.websocket.server.ServerEndpointConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.websocket.Endpoint;
+import jakarta.websocket.server.ServerContainer;
+import jakarta.websocket.server.ServerEndpointConfig;
import java.io.IOException;
import java.util.Map;
public interface WebSocketServerContainer extends ServerContainer {
- void doUpgrade(HttpServletRequest request, HttpServletResponse response, final ServerEndpointConfig sec, Endpoint endpoint, Map pathParams) throws ServletException, IOException;
+// void doUpgrade(HttpServletRequest request, HttpServletResponse response, final ServerEndpointConfig sec, Endpoint endpoint, Map pathParams) throws ServletException, IOException;
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/WebXmlParseEngine.java b/servlet-core/src/main/java/tech/smartboot/jakarta/WebXmlParseEngine.java
similarity index 95%
rename from servlet-core/src/main/java/org/smartboot/servlet/WebXmlParseEngine.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/WebXmlParseEngine.java
index 5ae3402c055c144f8a4e60c3e5158d5774213284..53bb3a077e29a33f6cafac44f4640106810d6d9b 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/WebXmlParseEngine.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/WebXmlParseEngine.java
@@ -8,26 +8,26 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet;
+package tech.smartboot.jakarta;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.MultipartConfigElement;
import org.smartboot.http.common.utils.NumberUtils;
import org.smartboot.http.common.utils.StringUtils;
-import org.smartboot.servlet.conf.ErrorPageInfo;
-import org.smartboot.servlet.conf.FilterInfo;
-import org.smartboot.servlet.conf.FilterMappingInfo;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.conf.WebAppInfo;
-import org.smartboot.servlet.enums.FilterMappingType;
-import org.smartboot.servlet.util.CollectionUtils;
-import org.smartboot.servlet.util.PathMatcherUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
+import tech.smartboot.jakarta.conf.ErrorPageInfo;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.FilterMappingInfo;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.conf.WebAppInfo;
+import tech.smartboot.jakarta.enums.FilterMappingType;
+import tech.smartboot.jakarta.util.CollectionUtils;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
-import javax.servlet.DispatcherType;
-import javax.servlet.MultipartConfigElement;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -160,7 +160,7 @@ class WebXmlParseEngine {
dispatcher.forEach(dispatcherElement -> dispatcherTypes.add(DispatcherType.valueOf(StringUtils.trim(dispatcherElement.getFirstChild().getNodeValue()))));
}
FilterMappingInfo filterInfo = new FilterMappingInfo(filterName, StringUtils.isBlank(urlPattern) ? FilterMappingType.SERVLET : FilterMappingType.URL, servletName, StringUtils.isBlank(urlPattern) ? null : PathMatcherUtil.addMapping(urlPattern), dispatcherTypes);
- webAppInfo.addFilterMapping(filterInfo);
+ webAppInfo.getFilters().get(filterName).addMapping(filterInfo);
}
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/DeploymentInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/DeploymentInfo.java
similarity index 91%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/DeploymentInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/DeploymentInfo.java
index 167e9da2e1bf65d61e2e44c29b912afb738b378a..29fdee37c7cf971bda1c8e1062ee1e8eebca275d 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/DeploymentInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/DeploymentInfo.java
@@ -8,20 +8,20 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
-
-import org.smartboot.servlet.AnnotationsLoader;
-import org.smartboot.servlet.impl.ServletContextWrapperListener;
-
-import javax.servlet.ServletContainerInitializer;
-import javax.servlet.ServletContextAttributeListener;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestAttributeListener;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.annotation.HandlesTypes;
-import javax.servlet.http.HttpSessionAttributeListener;
-import javax.servlet.http.HttpSessionIdListener;
-import javax.servlet.http.HttpSessionListener;
+package tech.smartboot.jakarta.conf;
+
+import jakarta.servlet.ServletContainerInitializer;
+import jakarta.servlet.ServletContextAttributeListener;
+import jakarta.servlet.ServletContextListener;
+import jakarta.servlet.ServletRequestAttributeListener;
+import jakarta.servlet.ServletRequestListener;
+import jakarta.servlet.annotation.HandlesTypes;
+import jakarta.servlet.http.HttpSessionAttributeListener;
+import jakarta.servlet.http.HttpSessionIdListener;
+import jakarta.servlet.http.HttpSessionListener;
+import tech.smartboot.jakarta.AnnotationsLoader;
+import tech.smartboot.jakarta.impl.ServletContextWrapperListener;
+
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -45,7 +45,6 @@ public class DeploymentInfo {
private final Map errorStatusPages = new HashMap<>();
private final Map errorPages = new HashMap<>();
private final Map filters = new HashMap<>();
- private final List filterMappings = new ArrayList<>();
private final Map initParameters = new HashMap<>();
private List servletContainerInitializers = new ArrayList<>();
private List servletContextAttributeListeners = new ArrayList<>();
@@ -231,14 +230,6 @@ public class DeploymentInfo {
return filters;
}
- public void addFilterMapping(FilterMappingInfo filterMappingInfo) {
- filterMappings.add(filterMappingInfo);
- }
-
- public List getFilterMappings() {
- return filterMappings;
- }
-
public Map getInitParameters() {
return initParameters;
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/ErrorPageInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ErrorPageInfo.java
similarity index 96%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/ErrorPageInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/ErrorPageInfo.java
index 6ab3bbbf4da931f4becc9dab6f83207deda036ff..8a3a19c2981e87c881fe5e1b5e2fcdb5c1ee9624 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/ErrorPageInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ErrorPageInfo.java
@@ -8,7 +8,7 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
/**
* @author 三刀
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/FilterInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterInfo.java
similarity index 80%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/FilterInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterInfo.java
index df97502342a0f12bc4820c896830bfa6bf57b198..77fe94ba1f0ee208a5efcc4be78c07e9604ffadb 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/FilterInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterInfo.java
@@ -8,11 +8,14 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
-import javax.servlet.Filter;
+import jakarta.servlet.Filter;
+
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -22,6 +25,10 @@ import java.util.Map;
public class FilterInfo {
private final Map initParams = new HashMap<>();
+ /**
+ * web.xml中的Filter映射信息配置
+ */
+ private final List filterMappings = new ArrayList<>();
private String filterClass;
private String filterName;
private Filter filter;
@@ -77,6 +84,15 @@ public class FilterInfo {
this.asyncSupported = asyncSupported;
}
+ public List getMappings() {
+ return Collections.unmodifiableList(filterMappings);
+ }
+
+ public FilterInfo addMapping(final FilterMappingInfo mapping) {
+ filterMappings.add(mapping);
+ return this;
+ }
+
@Override
public String toString() {
return "FilterInfo{" +
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/FilterMappingInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterMappingInfo.java
similarity index 92%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/FilterMappingInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterMappingInfo.java
index 38c5e798875321ff1ba9fc0dc9a6701708043d51..b7f8263d960c0967526185899c704d83802d2af6 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/FilterMappingInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/FilterMappingInfo.java
@@ -8,11 +8,11 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
-import org.smartboot.servlet.enums.FilterMappingType;
+import tech.smartboot.jakarta.enums.FilterMappingType;
-import javax.servlet.DispatcherType;
+import jakarta.servlet.DispatcherType;
import java.util.Set;
/**
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletContainerInitializerInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletContainerInitializerInfo.java
similarity index 92%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/ServletContainerInitializerInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletContainerInitializerInfo.java
index 81dc02be060a21325fdbff753ef2dc7b36572926..1aaccac0d3602336976c5f9430142c012580a466 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletContainerInitializerInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletContainerInitializerInfo.java
@@ -8,9 +8,9 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
-import javax.servlet.ServletContainerInitializer;
+import jakarta.servlet.ServletContainerInitializer;
import java.util.Set;
/**
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletInfo.java
similarity index 90%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/ServletInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletInfo.java
index 131a13b14b3e3d13c6192c458122ba047ee16f55..6ec900195580306ec92267095f80abe73af6f808 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletInfo.java
@@ -8,24 +8,24 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
-
+package tech.smartboot.jakarta.conf;
+
+import jakarta.servlet.MultipartConfigElement;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.UnavailableException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.smartboot.http.common.enums.HttpStatus;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
-import org.smartboot.servlet.impl.ServletConfigImpl;
-import org.smartboot.servlet.impl.ServletContextImpl;
-import org.smartboot.servlet.util.PathMatcherUtil;
-
-import javax.servlet.MultipartConfigElement;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import tech.smartboot.jakarta.impl.ServletConfigImpl;
+import tech.smartboot.jakarta.impl.ServletContextImpl;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -87,7 +87,7 @@ public class ServletInfo {
req.setAttribute(RequestDispatcher.ERROR_MESSAGE, e.getMessage());
req.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, HttpStatus.INTERNAL_SERVER_ERROR.value());
if (finalLocation != null) {
- servletContext.getRuntime().getDispatcherProvider().error(servletContext,finalLocation,req,resp);
+ servletContext.getRuntime().getDispatcherProvider().error(servletContext, finalLocation, req, resp);
// req.getRequestDispatcher(finalLocation).forward(req, resp);
} else {
LOGGER.error("error location is null");
@@ -139,6 +139,7 @@ public class ServletInfo {
*/
public ServletInfo addMapping(final String mapping) {
ServletMappingInfo servletMappingInfo = PathMatcherUtil.addMapping(mapping);
+ servletMappingInfo.setServletInfo(this);
mappings.add(servletMappingInfo);
return this;
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletMappingInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletMappingInfo.java
similarity index 60%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/ServletMappingInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletMappingInfo.java
index fef9f2c9d325339a6b5db61b3c5f18e1da1e90fd..089d4f468ad95c35342d88062f116113c8626cbe 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/ServletMappingInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/ServletMappingInfo.java
@@ -8,19 +8,20 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
-import org.smartboot.servlet.enums.ServletMappingTypeEnum;
+import jakarta.servlet.http.MappingMatch;
/**
* @author 三刀
* @version V1.0 , 2020/10/11
*/
public class ServletMappingInfo {
+ private ServletInfo servletInfo;
private final String mapping;
- private final ServletMappingTypeEnum mappingType;
+ private final MappingMatch mappingType;
- public ServletMappingInfo(String mapping, ServletMappingTypeEnum mappingType) {
+ public ServletMappingInfo(String mapping, MappingMatch mappingType) {
this.mapping = mapping;
this.mappingType = mappingType;
}
@@ -29,7 +30,15 @@ public class ServletMappingInfo {
return mapping;
}
- public ServletMappingTypeEnum getMappingType() {
+ public MappingMatch getMappingType() {
return mappingType;
}
+
+ public ServletInfo getServletInfo() {
+ return servletInfo;
+ }
+
+ public void setServletInfo(ServletInfo servletInfo) {
+ this.servletInfo = servletInfo;
+ }
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/conf/WebAppInfo.java b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/WebAppInfo.java
similarity index 89%
rename from servlet-core/src/main/java/org/smartboot/servlet/conf/WebAppInfo.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/conf/WebAppInfo.java
index 864d0bafc5810f67ee043c8aac8d670d3cc49a9a..83866163dbf9f03fa7f99b7aa7fc671156244f9a 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/conf/WebAppInfo.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/conf/WebAppInfo.java
@@ -8,7 +8,7 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.conf;
+package tech.smartboot.jakarta.conf;
import java.util.ArrayList;
import java.util.HashMap;
@@ -35,10 +35,6 @@ public class WebAppInfo {
*/
private final Map filters = new HashMap<>();
- /**
- * web.xml中的Filter映射信息配置
- */
- private final List filterMappings = new ArrayList<>();
private final List listeners = new ArrayList<>();
@@ -61,9 +57,6 @@ public class WebAppInfo {
filters.put(filterInfo.getFilterName(), filterInfo);
}
- public void addFilterMapping(FilterMappingInfo filterMappingInfo) {
- filterMappings.add(filterMappingInfo);
- }
public void addListener(String listener) {
listeners.add(listener);
@@ -97,10 +90,6 @@ public class WebAppInfo {
return filters;
}
- public List getFilterMappings() {
- return filterMappings;
- }
-
public List getListeners() {
return listeners;
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/enums/FilterMappingType.java b/servlet-core/src/main/java/tech/smartboot/jakarta/enums/FilterMappingType.java
similarity index 93%
rename from servlet-core/src/main/java/org/smartboot/servlet/enums/FilterMappingType.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/enums/FilterMappingType.java
index e8776b9afbed3163ddc304324163101a60ec86a5..473398292682bd61621628144a158e8d8a17b36f 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/enums/FilterMappingType.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/enums/FilterMappingType.java
@@ -8,7 +8,7 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.enums;
+package tech.smartboot.jakarta.enums;
/**
* Filter映射类型:、
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/enums/ServletContextPathType.java b/servlet-core/src/main/java/tech/smartboot/jakarta/enums/ServletContextPathType.java
similarity index 92%
rename from servlet-core/src/main/java/org/smartboot/servlet/enums/ServletContextPathType.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/enums/ServletContextPathType.java
index 8298272fcf22d5b8c52888759a07545dac5d21c9..366598778b5fa735f2be2e88930296f43412db08 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/enums/ServletContextPathType.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/enums/ServletContextPathType.java
@@ -8,7 +8,8 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.enums;
+package tech.smartboot.jakarta.enums;
+
/**
* @author 三刀
* @version V1.0 , 2020/11/14
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/exception/WrappedRuntimeException.java b/servlet-core/src/main/java/tech/smartboot/jakarta/exception/WrappedRuntimeException.java
similarity index 93%
rename from servlet-core/src/main/java/org/smartboot/servlet/exception/WrappedRuntimeException.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/exception/WrappedRuntimeException.java
index 329891c350a705d32075eeb9666f5a9c7b78985a..24ab3a7a10d6342190ee0ac13a2ec5e7df5a8089 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/exception/WrappedRuntimeException.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/exception/WrappedRuntimeException.java
@@ -8,7 +8,7 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.exception;
+package tech.smartboot.jakarta.exception;
/**
* @author 三刀
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/FilterMatchHandler.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/FilterMatchHandler.java
similarity index 75%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/FilterMatchHandler.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/FilterMatchHandler.java
index 792b17dd40bdad29276dee73ceeb0bfdacae0a65..32095dbdca30ca65d6a6150431952d27cb92912e 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/FilterMatchHandler.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/FilterMatchHandler.java
@@ -8,22 +8,21 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
-
+package tech.smartboot.jakarta.handler;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.Servlet;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
import org.smartboot.http.common.utils.StringUtils;
-import org.smartboot.servlet.conf.FilterInfo;
-import org.smartboot.servlet.conf.FilterMappingInfo;
-import org.smartboot.servlet.enums.FilterMappingType;
-import org.smartboot.servlet.util.PathMatcherUtil;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.enums.FilterMappingType;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -80,23 +79,23 @@ public class FilterMatchHandler extends Handler {
String contextPath = handlerContext.getServletContext().getContextPath();
HttpServletRequest request = (HttpServletRequest) handlerContext.getRequest();
List filters = new ArrayList<>();
- List filterMappings = handlerContext.getServletContext().getDeploymentInfo().getFilterMappings();
Map allFilters = handlerContext.getServletContext().getDeploymentInfo().getFilters();
- filterMappings.stream()
- .filter(filterMappingInfo -> filterMappingInfo.getDispatcher().contains(request.getDispatcherType()))
- .forEach(filterInfo -> {
- if (filterInfo.getMappingType() == FilterMappingType.URL) {
- if (PathMatcherUtil.matches(request.getRequestURI(), contextPath.length(), filterInfo.getServletUrlMapping()) > -1) {
- filters.add(allFilters.get(filterInfo.getFilterName()).getFilter());
- }
- } else if (filterInfo.getMappingType() == FilterMappingType.SERVLET) {
- if (handlerContext.getServletInfo() != null && StringUtils.equals(filterInfo.getServletNameMapping(), handlerContext.getServletInfo().getServlet().getServletConfig().getServletName())) {
- filters.add(allFilters.get(filterInfo.getFilterName()).getFilter());
+ allFilters.values().forEach(filter -> {
+ filter.getMappings().stream().filter(filterMappingInfo -> filterMappingInfo.getDispatcher().contains(request.getDispatcherType()))
+ .forEach(mappingInfo -> {
+ if (mappingInfo.getMappingType() == FilterMappingType.URL) {
+ if (PathMatcherUtil.matches(request.getRequestURI(), contextPath.length(), mappingInfo.getServletUrlMapping()) > -1) {
+ filters.add(filter.getFilter());
+ }
+ } else if (mappingInfo.getMappingType() == FilterMappingType.SERVLET) {
+ if (handlerContext.getServletInfo() != null && StringUtils.equals(mappingInfo.getServletNameMapping(), handlerContext.getServletInfo().getServlet().getServletConfig().getServletName())) {
+ filters.add(filter.getFilter());
+ }
+ } else {
+ throw new IllegalStateException();
}
- } else {
- throw new IllegalStateException();
- }
- });
+ });
+ });
return filters;
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/Handler.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/Handler.java
similarity index 93%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/Handler.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/Handler.java
index f0ae8d55adee82cecbb758d7a5cb304487c17c04..6a0c2786fe09da74320713a11a9399f965a321c8 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/Handler.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/Handler.java
@@ -8,9 +8,9 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
-import javax.servlet.ServletException;
+import jakarta.servlet.ServletException;
import java.io.IOException;
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerContext.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerContext.java
similarity index 88%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerContext.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerContext.java
index 3adc8548d9ad308011d2f74ecfc5de78046c9cce..5a8b0e7be0169fbbf1c17cf2922cc9e7151c99cd 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerContext.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerContext.java
@@ -8,14 +8,14 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
-import org.smartboot.servlet.SmartHttpServletRequest;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.impl.ServletContextImpl;
+import tech.smartboot.jakarta.SmartHttpServletRequest;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.impl.ServletContextImpl;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
/**
* 请求处理上下文对象
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerPipeline.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerPipeline.java
similarity index 94%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerPipeline.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerPipeline.java
index dfbf7f8600ed488bff585cfbb310a217ad259e34..6c9450764df8429d997fd34f33385c9b0252ecdb 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/HandlerPipeline.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/HandlerPipeline.java
@@ -8,9 +8,9 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
-import javax.servlet.ServletException;
+import jakarta.servlet.ServletException;
import java.io.IOException;
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletMatchHandler.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletMatchHandler.java
similarity index 51%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/ServletMatchHandler.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletMatchHandler.java
index 91b5a72616e86b6afae9882a7f528402d59156a4..a14db0a5f0d56969239e265243ccda786f5626a1 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletMatchHandler.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletMatchHandler.java
@@ -8,17 +8,17 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
-import org.smartboot.servlet.SmartHttpServletRequest;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.conf.ServletMappingInfo;
-import org.smartboot.servlet.exception.WrappedRuntimeException;
-import org.smartboot.servlet.impl.ServletContextImpl;
-import org.smartboot.servlet.util.PathMatcherUtil;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.MappingMatch;
+import tech.smartboot.jakarta.SmartHttpServletRequest;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.conf.ServletMappingInfo;
+import tech.smartboot.jakarta.exception.WrappedRuntimeException;
+import tech.smartboot.jakarta.impl.ServletContextImpl;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -57,46 +57,58 @@ public class ServletMatchHandler extends Handler {
request.setServletPath(cacheServlet.servletPathStart, cacheServlet.servletPathEnd);
request.setPathInfo(cacheServlet.pathInfoStart, cacheServlet.pathInfoEnd);
}
+ if (handlerContext.getServletInfo() != null) {
+ doNext(handlerContext);
+ return;
+ }
//匹配Servlet
- if (handlerContext.getServletInfo() == null) {
- Servlet servlet = null;
- for (Map.Entry entry : servletInfoMap.entrySet()) {
- final ServletInfo servletInfo = entry.getValue();
- if (!servletInfo.initialized()) {
- servletInfo.init(handlerContext.getServletContext());
+ ServletMappingInfo preMatchMapping = null;
+ for (Map.Entry entry : servletInfoMap.entrySet()) {
+ final ServletInfo servletInfo = entry.getValue();
+ if (!servletInfo.initialized()) {
+ servletInfo.init(handlerContext.getServletContext());
+ }
+ if (ServletInfo.DEFAULT_SERVLET_NAME.equals(servletInfo.getServletName())) {
+ continue;
+ }
+ for (ServletMappingInfo path : servletInfo.getMappings()) {
+ int servletPathEnd = PathMatcherUtil.matches(request.getRequestURI(), contextPath.length(), path);
+ //匹配失败
+ if (servletPathEnd < 0) {
+ continue;
}
- if (ServletInfo.DEFAULT_SERVLET_NAME.equals(servletInfo.getServletName())) {
+ //筛选匹配度更高的mapping
+ if (preMatchMapping != null && preMatchMapping.getMapping().length() > path.getMapping().length()) {
continue;
}
- for (ServletMappingInfo path : servletInfo.getMappings()) {
- int servletPathEnd = PathMatcherUtil.matches(request.getRequestURI(), contextPath.length(), path);
- //匹配失败
- if (servletPathEnd < 0) {
- continue;
- }
- servlet = servletInfo.getServlet();
- //《Servlet3.1规范中文版》3.5请求路径元素
- int servletPathStart = request.getContextPath().length();
- int pathInfoStart;
- int pathInfoEnd;
- if (servletPathEnd == 0) {
- //精确匹配和后缀匹配的 PathInfo 都为null
- servletPathEnd = servletPathStart;
- }
- if (servletPathEnd == request.getRequestURI().length()) {
- pathInfoStart = pathInfoEnd = -1;
- } else {
- pathInfoStart = servletPathEnd;
- pathInfoEnd = request.getRequestURI().length();
- }
- request.setServletPath(servletPathStart, servletPathEnd);
- request.setPathInfo(pathInfoStart, pathInfoEnd);
- cacheServletMap.put(request.getRequestURI(), new CacheServlet(servletInfo, servletPathStart, servletPathEnd, pathInfoStart, pathInfoEnd));
- break;
+ preMatchMapping = path;
+ handlerContext.setServletInfo(servletInfo);
+
+ //《Servlet3.1规范中文版》3.5请求路径元素
+ int servletPathStart = request.getContextPath().length();
+ int pathInfoStart;
+ int pathInfoEnd;
+ if (servletPathEnd == 0) {
+ //精确匹配和后缀匹配的 PathInfo 都为null
+ servletPathEnd = servletPathStart;
+ }
+ if (servletPathEnd == request.getRequestURI().length()) {
+ pathInfoStart = pathInfoEnd = -1;
+ } else {
+ pathInfoStart = servletPathEnd;
+ pathInfoEnd = request.getRequestURI().length();
}
- if (servlet != null) {
+ request.setServletPath(servletPathStart, servletPathEnd);
+ request.setPathInfo(pathInfoStart, pathInfoEnd);
+
+ request.setServletMappingInfo(path);
+
+ cacheServletMap.put(request.getRequestURI(), new CacheServlet(servletInfo, servletPathStart, servletPathEnd, pathInfoStart, pathInfoEnd));
+ //精准匹配,直接完成
+ if (path.getMappingType() == MappingMatch.EXACT && !path.getMapping().equals("/")) {
handlerContext.setServletInfo(servletInfo);
- break;
+ doNext(handlerContext);
+ return;
}
}
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletRequestListenerHandler.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletRequestListenerHandler.java
similarity index 81%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/ServletRequestListenerHandler.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletRequestListenerHandler.java
index 06bae1fff65c4f96d18bf2c5c9abd6f33397c994..14da0ffb75fdf69ebbd081066cd8e1ada4b885ed 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletRequestListenerHandler.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletRequestListenerHandler.java
@@ -8,15 +8,16 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequestEvent;
+import jakarta.servlet.ServletRequestListener;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequestEvent;
-import javax.servlet.ServletRequestListener;
import java.io.IOException;
import java.util.List;
@@ -29,6 +30,10 @@ public class ServletRequestListenerHandler extends Handler {
@Override
public void handleRequest(HandlerContext handlerContext) throws ServletException, IOException {
+ if (handlerContext.getRequest().getDispatcherType() != DispatcherType.REQUEST) {
+ doNext(handlerContext);
+ return;
+ }
ServletContext servletContext = handlerContext.getServletContext();
List servletRequestListeners = handlerContext.getServletContext().getDeploymentInfo().getServletRequestListeners();
ServletRequestEvent servletRequestEvent = servletRequestListeners.isEmpty() ? null : new ServletRequestEvent(servletContext, handlerContext.getRequest());
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletServiceHandler.java b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletServiceHandler.java
similarity index 73%
rename from servlet-core/src/main/java/org/smartboot/servlet/handler/ServletServiceHandler.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletServiceHandler.java
index c5513f6dc5508e549eeb5a225f3e9f532eff8ab1..288d1702e7a7a1522feddbe4eb9b67386a448f00 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/handler/ServletServiceHandler.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/handler/ServletServiceHandler.java
@@ -8,13 +8,13 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.handler;
+package tech.smartboot.jakarta.handler;
-import org.smartboot.servlet.conf.ServletInfo;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import tech.smartboot.jakarta.conf.ServletInfo;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import java.io.IOException;
/**
@@ -33,7 +33,8 @@ public class ServletServiceHandler extends Handler {
if (handlerContext.getServletInfo() != null) {
handlerContext.getServletInfo().getServlet().service(request, response);
} else {
- handlerContext.getServletContext().getServlet(ServletInfo.DEFAULT_SERVLET_NAME).service(request, response);
+ handlerContext.getServletContext().getDeploymentInfo().getServlets().get(ServletInfo.DEFAULT_SERVLET_NAME).getServlet().service(request, response);
}
+
}
}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationFilterRegistration.java b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationFilterRegistration.java
similarity index 66%
rename from servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationFilterRegistration.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationFilterRegistration.java
index 0484872d14f0cbd0f4e6c76ccce67eaebd793e66..214d7cf21ee0d6121dda6ea1538b191442493b7c 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationFilterRegistration.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationFilterRegistration.java
@@ -8,16 +8,15 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.impl;
+package tech.smartboot.jakarta.impl;
-import org.smartboot.servlet.conf.DeploymentInfo;
-import org.smartboot.servlet.conf.FilterInfo;
-import org.smartboot.servlet.conf.FilterMappingInfo;
-import org.smartboot.servlet.enums.FilterMappingType;
-import org.smartboot.servlet.util.PathMatcherUtil;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.FilterRegistration;
+import tech.smartboot.jakarta.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.FilterMappingInfo;
+import tech.smartboot.jakarta.enums.FilterMappingType;
+import tech.smartboot.jakarta.util.PathMatcherUtil;
-import javax.servlet.DispatcherType;
-import javax.servlet.FilterRegistration;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
@@ -30,50 +29,39 @@ import java.util.stream.Collectors;
* @author 三刀
* @version V1.0 , 2020/11/14
*/
-public class ApplicationFilterRegistration
- implements FilterRegistration.Dynamic {
+public class ApplicationFilterRegistration implements FilterRegistration.Dynamic {
private final FilterInfo filterDef;
- private final DeploymentInfo context;
- public ApplicationFilterRegistration(FilterInfo filterDef, DeploymentInfo context) {
+ public ApplicationFilterRegistration(FilterInfo filterDef) {
this.filterDef = filterDef;
- this.context = context;
}
@Override
- public void addMappingForServletNames(
- EnumSet dispatcherTypes, boolean isMatchAfter,
- String... servletNames) {
+ public void addMappingForServletNames(EnumSet dispatcherTypes, boolean isMatchAfter, String... servletNames) {
for (String servletName : servletNames) {
FilterMappingInfo mappingInfo = new FilterMappingInfo(filterDef.getFilterName(), FilterMappingType.SERVLET, servletName, null, dispatcherTypes);
- context.addFilterMapping(mappingInfo);
+ filterDef.addMapping(mappingInfo);
}
}
@Override
- public void addMappingForUrlPatterns(
- EnumSet dispatcherTypes, boolean isMatchAfter,
- String... urlPatterns) {
+ public void addMappingForUrlPatterns(EnumSet dispatcherTypes, boolean isMatchAfter, String... urlPatterns) {
for (String urlPattern : urlPatterns) {
FilterMappingInfo mappingInfo = new FilterMappingInfo(filterDef.getFilterName(), FilterMappingType.URL, null, PathMatcherUtil.addMapping(urlPattern), dispatcherTypes);
- context.addFilterMapping(mappingInfo);
+ filterDef.addMapping(mappingInfo);
}
}
@Override
public Collection getServletNameMappings() {
- return context.getFilterMappings().stream()
- .filter(filterMappingInfo -> filterMappingInfo.getMappingType() == FilterMappingType.SERVLET)
- .map(FilterMappingInfo::getServletNameMapping).collect(Collectors.toList());
+ return filterDef.getMappings().stream().filter(filterMappingInfo -> filterMappingInfo.getMappingType() == FilterMappingType.SERVLET).map(FilterMappingInfo::getServletNameMapping).collect(Collectors.toList());
}
@Override
public Collection getUrlPatternMappings() {
- return context.getFilterMappings().stream()
- .filter(filterMappingInfo -> filterMappingInfo.getMappingType() == FilterMappingType.SERVLET)
- .map(FilterMappingInfo::getServletNameMapping).collect(Collectors.toList());
+ return filterDef.getMappings().stream().filter(filterMappingInfo -> filterMappingInfo.getMappingType() == FilterMappingType.URL).map(filterMappingInfo -> filterMappingInfo.getServletUrlMapping().getMapping()).collect(Collectors.toList());
}
@Override
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationServletRegistration.java b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationServletRegistration.java
similarity index 92%
rename from servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationServletRegistration.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationServletRegistration.java
index c87100be68755209575a475a81f065458c87f75a..540e7a9437aa0eb4b078cfe7ff57c94aa79e1922 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/impl/ApplicationServletRegistration.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/ApplicationServletRegistration.java
@@ -8,17 +8,17 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.impl;
+package tech.smartboot.jakarta.impl;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
-import org.smartboot.servlet.conf.DeploymentInfo;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.conf.ServletMappingInfo;
+import tech.smartboot.jakarta.conf.DeploymentInfo;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.conf.ServletMappingInfo;
-import javax.servlet.MultipartConfigElement;
-import javax.servlet.ServletRegistration;
-import javax.servlet.ServletSecurityElement;
+import jakarta.servlet.MultipartConfigElement;
+import jakarta.servlet.ServletRegistration;
+import jakarta.servlet.ServletSecurityElement;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/impl/FilterConfigImpl.java b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/FilterConfigImpl.java
similarity index 89%
rename from servlet-core/src/main/java/org/smartboot/servlet/impl/FilterConfigImpl.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/impl/FilterConfigImpl.java
index 041138c2b554e24f59ba4364a7acef32ac5fae2e..d174009be4b4e097381063ccbee2f1811a15bea0 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/impl/FilterConfigImpl.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/FilterConfigImpl.java
@@ -8,12 +8,12 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.impl;
+package tech.smartboot.jakarta.impl;
-import org.smartboot.servlet.conf.FilterInfo;
+import tech.smartboot.jakarta.conf.FilterInfo;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
+import jakarta.servlet.FilterConfig;
+import jakarta.servlet.ServletContext;
import java.util.Collections;
import java.util.Enumeration;
diff --git a/servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletMappingImpl.java b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletMappingImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..d867cc86fac94acd3f828b12755edbe83c258237
--- /dev/null
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletMappingImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) [2022] smartboot [zhengjunweimail@163.com]
+ *
+ * 企业用户未经smartboot组织特别许可,需遵循AGPL-3.0开源协议合理合法使用本项目。
+ *
+ * Enterprise users are required to use this project reasonably
+ * and legally in accordance with the AGPL-3.0 open source agreement
+ * without special permission from the smartboot organization.
+ */
+
+package tech.smartboot.jakarta.impl;
+
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.MappingMatch;
+
+public class HttpServletMappingImpl implements HttpServletMapping {
+ private MappingMatch mappingMatch;
+ private String matchValue;
+ private String servletName;
+ private String pattern;
+
+ public HttpServletMappingImpl(MappingMatch mappingMatch, String matchValue, String servletName, String pattern) {
+ this.mappingMatch = mappingMatch;
+ this.matchValue = matchValue;
+ this.servletName = servletName;
+ this.pattern = pattern;
+ }
+
+ @Override
+ public String getMatchValue() {
+ return matchValue;
+ }
+
+ @Override
+ public String getPattern() {
+ return pattern;
+ }
+
+ @Override
+ public String getServletName() {
+ return servletName;
+ }
+
+ @Override
+ public MappingMatch getMappingMatch() {
+ return mappingMatch;
+ }
+}
diff --git a/servlet-core/src/main/java/org/smartboot/servlet/impl/HttpServletRequestImpl.java b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletRequestImpl.java
similarity index 85%
rename from servlet-core/src/main/java/org/smartboot/servlet/impl/HttpServletRequestImpl.java
rename to servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletRequestImpl.java
index 3a21fc5f9eb9256d08b24f7edfd52b1c10a1a9f2..d12bf2ea753bd19df34a642432d501fa6affc526 100644
--- a/servlet-core/src/main/java/org/smartboot/servlet/impl/HttpServletRequestImpl.java
+++ b/servlet-core/src/main/java/tech/smartboot/jakarta/impl/HttpServletRequestImpl.java
@@ -8,42 +8,45 @@
* without special permission from the smartboot organization.
*/
-package org.smartboot.servlet.impl;
-
+package tech.smartboot.jakarta.impl;
+
+import jakarta.servlet.AsyncContext;
+import jakarta.servlet.DispatcherType;
+import jakarta.servlet.MultipartConfigElement;
+import jakarta.servlet.RequestDispatcher;
+import jakarta.servlet.ServletConnection;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletRequestAttributeEvent;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletMapping;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
+import jakarta.servlet.http.HttpUpgradeHandler;
+import jakarta.servlet.http.Part;
import org.smartboot.http.common.enums.HeaderNameEnum;
import org.smartboot.http.common.logging.Logger;
import org.smartboot.http.common.logging.LoggerFactory;
import org.smartboot.http.common.utils.NumberUtils;
import org.smartboot.http.common.utils.StringUtils;
import org.smartboot.http.server.HttpRequest;
-import org.smartboot.servlet.ServletContextRuntime;
-import org.smartboot.servlet.SmartHttpServletRequest;
-import org.smartboot.servlet.conf.ServletInfo;
-import org.smartboot.servlet.impl.fileupload.SmartHttpRequestContext;
-import org.smartboot.servlet.provider.SessionProvider;
-import org.smartboot.servlet.third.commons.fileupload.FileItem;
-import org.smartboot.servlet.third.commons.fileupload.FileUpload;
-import org.smartboot.servlet.third.commons.fileupload.FileUploadException;
-import org.smartboot.servlet.third.commons.fileupload.disk.DiskFileItemFactory;
-import org.smartboot.servlet.util.CollectionUtils;
-import org.smartboot.servlet.util.DateUtil;
import org.smartboot.socket.util.Attachment;
+import tech.smartboot.jakarta.ServletContextRuntime;
+import tech.smartboot.jakarta.SmartHttpServletRequest;
+import tech.smartboot.jakarta.conf.ServletInfo;
+import tech.smartboot.jakarta.conf.ServletMappingInfo;
+import tech.smartboot.jakarta.impl.fileupload.SmartHttpRequestContext;
+import tech.smartboot.jakarta.provider.SessionProvider;
+import tech.smartboot.jakarta.third.commons.fileupload.FileItem;
+import tech.smartboot.jakarta.third.commons.fileupload.FileUpload;
+import tech.smartboot.jakarta.third.commons.fileupload.FileUploadException;
+import tech.smartboot.jakarta.third.commons.fileupload.disk.DiskFileItemFactory;
+import tech.smartboot.jakarta.util.CollectionUtils;
+import tech.smartboot.jakarta.util.DateUtil;
-import javax.servlet.AsyncContext;
-import javax.servlet.DispatcherType;
-import javax.servlet.MultipartConfigElement;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpUpgradeHandler;
-import javax.servlet.http.Part;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -111,6 +114,8 @@ public class HttpServletRequestImpl implements SmartHttpServletRequest {
private volatile AsyncContext asyncContext = null;
private final CompletableFuture