Class FormBody
java.lang.Object
cloud.opencode.base.web.body.FormBody
- All Implemented Interfaces:
RequestBody
Form Body - URL-Encoded Form Request Body
表单请求体 - URL 编码的表单请求体
Features | 主要功能:
- URL-encoded form parameter encoding - URL 编码的表单参数编码
- Builder pattern for fluent construction - 构建器模式支持流式构建
- Multi-value parameter support - 多值参数支持
- Immutable once built - 构建后不可变
Usage Examples | 使用示例:
// From key-value pairs
FormBody body = FormBody.of("username", "john", "password", "secret");
// Using builder
FormBody body = FormBody.builder()
.add("username", "john")
.addIfNotNull("email", email)
.build();
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构建后不可变)
- Null-safe: No (values must not be null) - 空值安全: 否(值不能为 null)
- Since:
- JDK 25, opencode-base-web V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface RequestBody
RequestBody.SimpleBody -
Method Summary
-
Method Details
-
empty
-
of
-
of
-
builder
-
getContentType
- Specified by:
getContentTypein interfaceRequestBody
-
getBodyPublisher
- Specified by:
getBodyPublisherin interfaceRequestBody
-
getContentLength
public long getContentLength()- Specified by:
getContentLengthin interfaceRequestBody
-
size
public int size() -
isEmpty
public boolean isEmpty() -
getEntries
-
getEncoded
-
get
-
getAll
-
toMap
-
toString
-