public enum GlobalHeaders extends Enum<GlobalHeaders>
HttpRequest
中自定义头部信息覆盖之Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
GlobalHeaders |
clearHeaders()
清除所有头信息,包括全局头信息
|
String |
header(Header name)
根据name获取头信息
|
GlobalHeaders |
header(Header name,
String value)
设置一个header
覆盖模式,则替换之前的值 |
GlobalHeaders |
header(Header name,
String value,
boolean isOverride)
设置一个header
如果覆盖模式,则替换之前的值,否则加入到值列表中 |
GlobalHeaders |
header(Map<String,List<String>> headers)
设置请求头
不覆盖原有请求头 |
String |
header(String name)
根据name获取头信息
|
GlobalHeaders |
header(String name,
String value)
设置一个header
覆盖模式,则替换之前的值 |
GlobalHeaders |
header(String name,
String value,
boolean isOverride)
设置一个header
如果覆盖模式,则替换之前的值,否则加入到值列表中 |
List<String> |
headerList(String name)
根据name获取头信息列表
|
Map<String,List<String>> |
headers()
获取headers
|
GlobalHeaders |
putDefault(boolean isReset)
加入默认的头部信息
|
GlobalHeaders |
removeHeader(Header name)
移除一个头信息
|
GlobalHeaders |
removeHeader(String name)
移除一个头信息
|
static GlobalHeaders |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static GlobalHeaders[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final GlobalHeaders INSTANCE
public static GlobalHeaders[] values()
for (GlobalHeaders c : GlobalHeaders.values()) System.out.println(c);
public static GlobalHeaders valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic GlobalHeaders putDefault(boolean isReset)
isReset
- 是否重置所有头部信息(删除自定义保留默认)public List<String> headerList(String name)
name
- Header名public GlobalHeaders header(String name, String value, boolean isOverride)
name
- Header名value
- Header值isOverride
- 是否覆盖已有值public GlobalHeaders header(Header name, String value, boolean isOverride)
name
- Header名value
- Header值isOverride
- 是否覆盖已有值public GlobalHeaders header(Header name, String value)
name
- Header名value
- Header值public GlobalHeaders header(String name, String value)
name
- Header名value
- Header值public GlobalHeaders header(Map<String,List<String>> headers)
headers
- 请求头public GlobalHeaders removeHeader(String name)
name
- Header名public GlobalHeaders removeHeader(Header name)
name
- Header名public GlobalHeaders clearHeaders()
Copyright © 2024. All rights reserved.