- java.lang.Object
-
- net.dongliu.cute.http.HTTPHeaders
-
public class HTTPHeaders extends Object
The http headers. This class is thread-safe.- 作者:
- Liu Dong
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 Map<String,List<String>>allHeaders()Get all header as MapOptional<ContentType>contentType()Get content type set in http header.HTTPCookiescookies()Get cookies in this header.Optional<String>getHeader(String name)Get the first header value matched name.List<String>getHeaders(String name)Get headers by name.OptionalLonggetLongHeader(String name)Get header value as long.static HTTPHeadersof(Collection<? extends HTTPHeader> headers)Construct headers from a Collection of header.static HTTPHeadersofHttpHeaders(HttpHeaders httpHeaders)Construct a headers, from immutable jdk http client headers.
-
-
-
方法详细资料
-
ofHttpHeaders
public static HTTPHeaders ofHttpHeaders(HttpHeaders httpHeaders)
Construct a headers, from immutable jdk http client headers.- 参数:
httpHeaders- the http headers- 返回:
- Headers
-
of
public static HTTPHeaders of(Collection<? extends HTTPHeader> headers)
Construct headers from a Collection of header.- 参数:
headers- the header collection- 返回:
- Headers
-
getHeaders
public List<String> getHeaders(String name)
Get headers by name. If not exists, return empty list
-
getLongHeader
public OptionalLong getLongHeader(String name)
Get header value as long.
-
allHeaders
public Map<String,List<String>> allHeaders()
Get all header as Map- 返回:
- immutable map of headers. return empty map if do not has any header.
-
contentType
public Optional<ContentType> contentType()
Get content type set in http header. If do not set Content-Type header, or parse header error, return empty Optional.- 返回:
- the charset
-
cookies
public HTTPCookies cookies()
Get cookies in this header.- 返回:
- a immutable list of cookies
-
-