Module cloud.opencode.base.web


module cloud.opencode.base.web
OpenCode Base Web Module OpenCode 基础 Web 模块

Provides lightweight, framework-agnostic Web utilities including unified response format, pagination, request context, and result encryption.

提供轻量级、框架无关的 Web 工具,包括统一响应格式、分页、请求上下文和响应加密。

Key Features | 主要功能:

  • Result - Unified response (immutable Record) - 统一响应(不可变Record)
  • Results - Response builder factory - 响应构建工厂
  • ResultCode - Response code interface with SPI - 响应码接口(SPI扩展)
  • PageRequest/PageResult - Pagination support - 分页支持
  • RequestContextHolder - Thread-safe context with async support - 线程安全上下文
  • ResultEncryptor - Response encryption SPI - 响应加密SPI
  • ExceptionConverter - Exception to Result conversion - 异常转换
  • TraceId integration - 链路追踪集成

Design Principles | 设计原则:

  • Framework agnostic - No Spring/Jakarta EE dependency - 框架无关
  • Immutable Records - Thread-safe by design - 不可变Record
  • SPI extensible - Result codes and encryption - SPI可扩展
Since:
JDK 25, opencode-base-web V1.0.0
Author:
Leon Soo