Class HttpHeaders
-
- All Implemented Interfaces:
-
android.os.Parcelable,com.naver.ads.inspector.JSONObjectSerializable,com.naver.ads.inspector.MapSerializable,kotlin.collections.Iterable
public final class HttpHeaders implements Parcelable, Iterable<HttpHeader>, MapSerializable<String>, JSONObjectSerializable
A data structure representing HTTP request or response headers, mapping String header names to a list of String values, also offering accessors for common application-level data types.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringCACHE_CONTROLpublic final static StringCONTENT_LENGTHpublic final static StringCONTENT_TYPEpublic final static StringCONTENT_ENCODINGpublic final static StringACCEPTpublic final static StringACCEPT_CHARSETpublic final static StringACCEPT_ENCODINGpublic final static StringACCEPT_LANGUAGEpublic final static StringACCESS_CONTROL_REQUEST_HEADERSpublic final static StringACCESS_CONTROL_REQUEST_METHODpublic final static StringAUTHORIZATIONpublic final static StringCONNECTIONpublic final static StringCOOKIEpublic final static StringUSER_AGENTpublic final static StringACCEPT_RANGESpublic final static StringACCESS_CONTROL_ALLOW_HEADERSpublic final static StringACCESS_CONTROL_ALLOW_METHODSpublic final static StringACCESS_CONTROL_ALLOW_ORIGINprivate final Map<String, HttpHeader>headers
-
Constructor Summary
Constructors Constructor Description HttpHeaders()Creates a HttpHeaders instance with empty headers map. HttpHeaders(Iterable<HttpHeader> headers)Creates a HttpHeaders instance with the provided initial headers. HttpHeaders(Map<String, HttpHeader> headers)Creates a HttpHeaders instance with headers map.
-
Method Summary
Modifier and Type Method Description final Map<String, HttpHeader>getHeaders()the headers map. final IntegergetSize()Returns the number of headers in the collection. final HttpHeadersput(String name, String value)Puts a header name and header value. final HttpHeadersput(Pair<String, String> pair)Puts a header name and header value pair. final HttpHeaderremove(String name)Removes the header value mapped to the given name. final HttpHeaderget(String name)Returns the HttpHeader mapped to the given name final StringgetValue(String name)Returns a comma separated values mapped to the given name, in the addition order. final List<String>getValues(String name)Returns a list of header values mapped to the given name, in the addition order. Map<String, String>toMap()Returns a map that associates header names to the value associated with the corresponding header name. Iterator<HttpHeader>iterator()StringtoString()Returns a string that associated header names to the value of comma-separated with the corresponding header name. JSONObjecttoJSONObject()Returns a JSONObject that associates header names to the value associated with the corresponding header name. -
-
Constructor Detail
-
HttpHeaders
HttpHeaders()
Creates a HttpHeaders instance with empty headers map.
-
HttpHeaders
HttpHeaders(Iterable<HttpHeader> headers)
Creates a HttpHeaders instance with the provided initial headers.- Parameters:
headers- the collection of initial headers
-
HttpHeaders
HttpHeaders(Map<String, HttpHeader> headers)
Creates a HttpHeaders instance with headers map.
-
-
Method Detail
-
getHeaders
final Map<String, HttpHeader> getHeaders()
the headers map.
-
getSize
final Integer getSize()
Returns the number of headers in the collection.
- Returns:
the number of headers in this collection.
-
put
final HttpHeaders put(String name, String value)
Puts a header name and header value.
- Parameters:
name- the name of the header.value- the value of the value.- Returns:
this HttpHeaders
-
put
final HttpHeaders put(Pair<String, String> pair)
Puts a header name and header value pair.
- Parameters:
pair- the pair of header name and header value.- Returns:
this HttpHeaders
-
remove
final HttpHeader remove(String name)
Removes the header value mapped to the given name.
-
get
final HttpHeader get(String name)
Returns the HttpHeader mapped to the given name
-
getValue
final String getValue(String name)
Returns a comma separated values mapped to the given name, in the addition order.
-
getValues
final List<String> getValues(String name)
Returns a list of header values mapped to the given name, in the addition order.
-
toMap
Map<String, String> toMap()
Returns a map that associates header names to the value associated with the corresponding header name.
-
iterator
Iterator<HttpHeader> iterator()
-
toString
String toString()
Returns a string that associated header names to the value of comma-separated with the corresponding header name.
-
toJSONObject
JSONObject toJSONObject()
Returns a JSONObject that associates header names to the value associated with the corresponding header name.
-
-
-
-