Package com.xxl.tool.http.http.enums
Enum Class Header
- All Implemented Interfaces:
Serializable,Comparable<Header>,Constable
HTTP Header
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription告诉服务器客户端可以接受的字符编码集 可选值: - UTF-8:最常用的字符编码,支持所有语言 - GBK:主要用于中文编码HTTP 身份验证机制 可选方式: - Basic Auth:基本身份验证,使用用户名和密码进行加密传输 - Bearer Token:通常用于 OAuth2 认证,Token 放在请求头的 Authorization 字段中,格式为 Bearer- Digest Auth:摘要身份验证,一种更安全的认证方式,它通过 MD5 哈希算法对用户名、密码和请求数据进行加密 - API Key: API 密钥认证,通过在请求头中包含一个特殊的 API Key 来标识请求的合法性 控制当前连接的行为,决定是否复用连接或在请求完成后关闭连接。资源的 MIME 类型,告诉服务器实际发送的数据类型。请求头中包含的Cookie信息 格式: - name1=value1; name2=value2; name3=value3服务器返回给客户端的一个或多个 Cookie 信息 格式: - name1=value1; name2=value2; name3=value3客户端标识: -
Field Summary
Fields -
Method Summary
-
Enum Constant Details
-
CONNECTION
控制当前连接的行为,决定是否复用连接或在请求完成后关闭连接。 可选值: - Keep-Alive:保持连接打开,允许后续请求复用该连接;减少连接建立开销,适用于需要发送多个请求的场景;(推荐) - close:请求完成后立即关闭连接;适用于单次请求或资源密集型操作; -
CONTENT_TYPE
资源的 MIME 类型,告诉服务器实际发送的数据类型。 可选值: - application/x-www-form-urlencoded:表单数据(默认编码方式) - application/json:JSON 数据 - application/xml:XML 数据 - text/html:HTML 文档 - text/plain:纯文本 -
ACCEPT_CHARSET
告诉服务器客户端可以接受的字符编码集 可选值: - UTF-8:最常用的字符编码,支持所有语言 - GBK:主要用于中文编码 -
COOKIE
请求头中包含的Cookie信息 格式: - name1=value1; name2=value2; name3=value3 -
AUTHORIZATION
HTTP 身份验证机制 可选方式: - Basic Auth:基本身份验证,使用用户名和密码进行加密传输 - Bearer Token:通常用于 OAuth2 认证,Token 放在请求头的 Authorization 字段中,格式为 Bearer- Digest Auth:摘要身份验证,一种更安全的认证方式,它通过 MD5 哈希算法对用户名、密码和请求数据进行加密 - API Key: API 密钥认证,通过在请求头中包含一个特殊的 API Key 来标识请求的合法性 1、Basic格式: Authorization: Basic base64( "{username}:{password}" ) 2、Bearer格式: Authorization: Bearer token 3、Digest格式: Authorization: Digest username="Mufasa", realm="……", …… 4、API Key格式: X-API-Key: xxxxx -
SET_COOKIE
服务器返回给客户端的一个或多个 Cookie 信息 格式: - name1=value1; name2=value2; name3=value3 -
USER_AGENT
客户端标识:示例: 1、:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 2、:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
-
-
Field Details
-
DEFAULT_USER_AGENT_WIN
default user-agent, for windows- See Also:
-
DEFAULT_USER_AGENT_MAC
default user-agent, for mac- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
-
toString
-