public class HttpHeaders extends Object implements Iterable<HttpHeader>
| Constructor and Description |
|---|
HttpHeaders()
Create an empty HttpHeaders instance.
|
HttpHeaders(Iterable<HttpHeader> headers)
Create a HttpHeaders instance with the provided initial headers.
|
HttpHeaders(Map<String,String> headers)
Create a HttpHeaders instance with the provided initial headers.
|
| Modifier and Type | Method and Description |
|---|---|
HttpHeader |
get(String name)
Gets the
header for the provided header name. |
int |
getSize()
Gets the number of headers in the collection.
|
String |
getValue(String name)
Get the value for the provided header name.
|
String[] |
getValues(String name)
Get the values for the provided header name.
|
Iterator<HttpHeader> |
iterator() |
HttpHeaders |
put(String name,
String value)
Sets a
header with the given name and value. |
HttpHeader |
remove(String name)
Removes the
header with the provided header name. |
Stream<HttpHeader> |
stream()
Get a
Stream representation of the HttpHeader values in this instance. |
Map<String,String> |
toMap()
Gets a
Map representation of the HttpHeaders collection. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic HttpHeaders()
public HttpHeaders(Map<String,String> headers)
headers - the map of initial headerspublic HttpHeaders(Iterable<HttpHeader> headers)
headers - the collection of initial headerspublic int getSize()
public HttpHeaders put(String name, String value)
header with the given name and value.
If header with same name already exists then the value will be overwritten.
name - the namevalue - the valuepublic HttpHeader get(String name)
header for the provided header name. Null is returned if the header isn't
found.name - the name of the header to find.public HttpHeader remove(String name)
header with the provided header name. Null is returned if the header
isn't found.name - the name of the header to remove.public String getValue(String name)
Null is returned if the header name isn't found.name - the name of the header whose value is being retrieved.public String[] getValues(String name)
Null is returned if the header name isn't found.
This returns getValue split by comma.
name - the name of the header whose value is being retrieved.public Map<String,String> toMap()
Map representation of the HttpHeaders collection.public Iterator<HttpHeader> iterator()
iterator in interface Iterable<HttpHeader>public Stream<HttpHeader> stream()
Stream representation of the HttpHeader values in this instance.Stream of all header values in this instance.Copyright © 2019 Microsoft Corporation. All rights reserved.