java.lang.Object
org.miaixz.bus.http.UnoUrl.Builder
- Enclosing class:
UnoUrl
URL 构建器
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEncodedPathSegment(String encodedPathSegment) 添加编码后的路径段addEncodedPathSegments(String encodedPathSegments) 添加编码后的路径段列表addEncodedQueryParameter(String encodedName, String encodedValue) 添加编码后的查询参数addPathSegment(String pathSegment) 添加路径段addPathSegments(String pathSegments) 添加路径段列表addQueryParameter(String name, String value) 添加查询参数build()构建 UnoUrl 实例encodedFragment(String encodedFragment) 设置编码后的片段encodedPassword(String encodedPassword) 设置编码后的密码encodedPath(String encodedPath) 设置编码后的路径encodedQuery(String encodedQuery) 设置编码后的查询字符串encodedUsername(String encodedUsername) 设置编码后的用户名设置片段设置主机名设置密码port(int port) 设置端口号设置查询字符串removeAllEncodedQueryParameters(String encodedName) 移除编码后的所有查询参数移除指定名称的所有查询参数removePathSegment(int index) 移除路径段设置协议setEncodedPathSegment(int index, String encodedPathSegment) 设置编码后的路径段setEncodedQueryParameter(String encodedName, String encodedValue) 设置编码后的查询参数(替换现有参数)setPathSegment(int index, String pathSegment) 设置路径段setQueryParameter(String name, String value) 设置查询参数(替换现有参数)toString()返回 URL 的字符串表示设置用户名
-
Constructor Details
-
Builder
public Builder()默认构造函数
-
-
Method Details
-
scheme
设置协议- Parameters:
scheme- 协议(http 或 https)- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 scheme 为 nullIllegalArgumentException- 如果协议无效
-
username
设置用户名- Parameters:
username- 用户名- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 username 为 null
-
encodedUsername
设置编码后的用户名- Parameters:
encodedUsername- 编码后的用户名- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedUsername 为 null
-
password
设置密码- Parameters:
password- 密码- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 password 为 null
-
encodedPassword
设置编码后的密码- Parameters:
encodedPassword- 编码后的密码- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedPassword 为 null
-
host
设置主机名- Parameters:
host- 主机名(普通主机名、IPv4、IPv6 或编码的 IDN)- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 host 为 nullIllegalArgumentException- 如果主机名无效
-
port
设置端口号- Parameters:
port- 端口号- Returns:
- 当前 Builder 实例
- Throws:
IllegalArgumentException- 如果端口号无效
-
addPathSegment
添加路径段- Parameters:
pathSegment- 路径段- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 pathSegment 为 null
-
addPathSegments
添加路径段列表- Parameters:
pathSegments- 路径段字符串- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 pathSegments 为 null
-
addEncodedPathSegment
添加编码后的路径段- Parameters:
encodedPathSegment- 编码后的路径段- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedPathSegment 为 null
-
addEncodedPathSegments
添加编码后的路径段列表- Parameters:
encodedPathSegments- 编码后的路径段字符串- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedPathSegments 为 null
-
setPathSegment
设置路径段- Parameters:
index- 索引pathSegment- 路径段- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 pathSegment 为 nullIllegalArgumentException- 如果路径段无效
-
setEncodedPathSegment
设置编码后的路径段- Parameters:
index- 索引encodedPathSegment- 编码后的路径段- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedPathSegment 为 nullIllegalArgumentException- 如果路径段无效
-
removePathSegment
移除路径段- Parameters:
index- 索引- Returns:
- 当前 Builder 实例
-
encodedPath
设置编码后的路径- Parameters:
encodedPath- 编码后的路径- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedPath 为 nullIllegalArgumentException- 如果路径无效
-
query
设置查询字符串- Parameters:
query- 查询字符串- Returns:
- 当前 Builder 实例
-
encodedQuery
设置编码后的查询字符串- Parameters:
encodedQuery- 编码后的查询字符串- Returns:
- 当前 Builder 实例
-
addQueryParameter
添加查询参数- Parameters:
name- 参数名称value- 参数值- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 name 为 null
-
addEncodedQueryParameter
添加编码后的查询参数- Parameters:
encodedName- 编码后的参数名称encodedValue- 编码后的参数值- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedName 为 null
-
setQueryParameter
设置查询参数(替换现有参数)- Parameters:
name- 参数名称value- 参数值- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 name 为 null
-
setEncodedQueryParameter
设置编码后的查询参数(替换现有参数)- Parameters:
encodedName- 编码后的参数名称encodedValue- 编码后的参数值- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedName 为 null
-
removeAllQueryParameters
移除指定名称的所有查询参数- Parameters:
name- 参数名称- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 name 为 null
-
removeAllEncodedQueryParameters
移除编码后的所有查询参数- Parameters:
encodedName- 编码后的参数名称- Returns:
- 当前 Builder 实例
- Throws:
NullPointerException- 如果 encodedName 为 null
-
fragment
设置片段- Parameters:
fragment- 片段- Returns:
- 当前 Builder 实例
-
encodedFragment
设置编码后的片段- Parameters:
encodedFragment- 编码后的片段- Returns:
- 当前 Builder 实例
-
build
构建 UnoUrl 实例- Returns:
- UnoUrl 实例
- Throws:
IllegalStateException- 如果 scheme 或 host 未设置
-
toString
返回 URL 的字符串表示
-