azure-docs-sdk-java/docs-ref-autogen/com.azure.core.http.HttpHea...

393 строки
35 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.HttpHeaders"
fullName: "com.azure.core.http.HttpHeaders"
name: "HttpHeaders"
nameWithType: "HttpHeaders"
summary: "Represents a collection of headers on an HTTP request or response."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public class **HttpHeaders**</br> implements <a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />&gt;"
constructors:
- uid: "com.azure.core.http.HttpHeaders.HttpHeaders()"
fullName: "com.azure.core.http.HttpHeaders.HttpHeaders()"
name: "HttpHeaders()"
nameWithType: "HttpHeaders.HttpHeaders()"
summary: "Create an empty Http<wbr>Headers instance."
syntax: "public HttpHeaders()"
desc: "Create an empty HttpHeaders instance."
- uid: "com.azure.core.http.HttpHeaders.HttpHeaders(int)"
fullName: "com.azure.core.http.HttpHeaders.HttpHeaders(int initialCapacity)"
name: "HttpHeaders(int initialCapacity)"
nameWithType: "HttpHeaders.HttpHeaders(int initialCapacity)"
summary: "Create a Http<wbr>Headers instance with an initial `size` empty headers"
parameters:
- description: "the initial capacity of headers map."
name: "initialCapacity"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpHeaders(int initialCapacity)"
desc: "Create a HttpHeaders instance with an initial `size` empty headers"
- uid: "com.azure.core.http.HttpHeaders.HttpHeaders(java.lang.Iterable<com.azure.core.http.HttpHeader>)"
fullName: "com.azure.core.http.HttpHeaders.HttpHeaders(Iterable<HttpHeader> headers)"
name: "HttpHeaders(Iterable<HttpHeader> headers)"
nameWithType: "HttpHeaders.HttpHeaders(Iterable<HttpHeader> headers)"
summary: "Create a Http<wbr>Headers instance with the provided initial headers."
parameters:
- description: "the collection of initial headers"
name: "headers"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />&gt;"
syntax: "public HttpHeaders(Iterable<HttpHeader> headers)"
desc: "Create a HttpHeaders instance with the provided initial headers."
- uid: "com.azure.core.http.HttpHeaders.HttpHeaders(java.util.Map<java.lang.String,java.lang.String>)"
fullName: "com.azure.core.http.HttpHeaders.HttpHeaders(Map<String,String> headers)"
name: "HttpHeaders(Map<String,String> headers)"
nameWithType: "HttpHeaders.HttpHeaders(Map<String,String> headers)"
summary: "Create a Http<wbr>Headers instance with the provided initial headers."
parameters:
- description: "the map of initial headers"
name: "headers"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Map.html\">Map</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "public HttpHeaders(Map<String,String> headers)"
desc: "Create a HttpHeaders instance with the provided initial headers."
methods:
- uid: "com.azure.core.http.HttpHeaders.add(com.azure.core.http.HttpHeaderName,java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.add(HttpHeaderName name, String value)"
name: "add(HttpHeaderName name, String value)"
nameWithType: "HttpHeaders.add(HttpHeaderName name, String value)"
summary: "Adds a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value if a header with that name doesn't already exist, otherwise adds the `value` to the existing header."
parameters:
- description: "The name of the header."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
- description: "The value of the header."
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpHeaders add(HttpHeaderName name, String value)"
desc: "Adds a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value if a header with that name doesn't already exist, otherwise adds the `value` to the existing header."
returns:
description: "The updated HttpHeaders object."
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.add(java.lang.String,java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.add(String name, String value)"
name: "add(String name, String value)"
nameWithType: "HttpHeaders.add(String name, String value)"
summary: "Adds a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value if a header with that name doesn't already exist, otherwise adds the `value` to the existing header."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.add(com.azure.core.http.HttpHeaderName,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#add(HttpHeaderName, String)\"></xref> as it provides better performance."
parameters:
- description: "The name of the header."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The value of the header."
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeaders add(String name, String value)"
desc: "Adds a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value if a header with that name doesn't already exist, otherwise adds the `value` to the existing header."
hasDeprecatedTag: true
returns:
description: "The updated HttpHeaders object."
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.get(com.azure.core.http.HttpHeaderName)"
fullName: "com.azure.core.http.HttpHeaders.get(HttpHeaderName name)"
name: "get(HttpHeaderName name)"
nameWithType: "HttpHeaders.get(HttpHeaderName name)"
summary: "Gets the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> for the provided header name."
parameters:
- description: "the name of the header to find."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpHeader get(HttpHeaderName name)"
desc: "Gets the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> for the provided header name. null is returned if the header isn't found."
returns:
description: "the header if found, null otherwise."
type: "<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.get(java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.get(String name)"
name: "get(String name)"
nameWithType: "HttpHeaders.get(String name)"
summary: "Gets the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> for the provided header name."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.get(com.azure.core.http.HttpHeaderName)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#get(HttpHeaderName)\"></xref> as it provides better performance."
parameters:
- description: "the name of the header to find."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeader get(String name)"
desc: "Gets the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> for the provided header name. null is returned if the header isn't found."
hasDeprecatedTag: true
returns:
description: "the header if found, null otherwise."
type: "<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.getSize()"
fullName: "com.azure.core.http.HttpHeaders.getSize()"
name: "getSize()"
nameWithType: "HttpHeaders.getSize()"
summary: "Gets the number of headers in the collection."
syntax: "public int getSize()"
desc: "Gets the number of headers in the collection."
returns:
description: "the number of headers in this collection."
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.getValue(com.azure.core.http.HttpHeaderName)"
fullName: "com.azure.core.http.HttpHeaders.getValue(HttpHeaderName name)"
name: "getValue(HttpHeaderName name)"
nameWithType: "HttpHeaders.getValue(HttpHeaderName name)"
summary: "Get the value for the provided header name."
parameters:
- description: "the name of the header whose value is being retrieved."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
syntax: "public String getValue(HttpHeaderName name)"
desc: "Get the value for the provided header name. null is returned if the header name isn't found."
returns:
description: "the value of the header, or null if the header isn't found"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.core.http.HttpHeaders.getValue(java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.getValue(String name)"
name: "getValue(String name)"
nameWithType: "HttpHeaders.getValue(String name)"
summary: "Get the value for the provided header name."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.getValue(com.azure.core.http.HttpHeaderName)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getValue(HttpHeaderName)\"></xref> as it provides better performance."
parameters:
- description: "the name of the header whose value is being retrieved."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public String getValue(String name)"
desc: "Get the value for the provided header name. null is returned if the header name isn't found."
hasDeprecatedTag: true
returns:
description: "the value of the header, or null if the header isn't found"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.core.http.HttpHeaders.getValues(com.azure.core.http.HttpHeaderName)"
fullName: "com.azure.core.http.HttpHeaders.getValues(HttpHeaderName name)"
name: "getValues(HttpHeaderName name)"
nameWithType: "HttpHeaders.getValues(HttpHeaderName name)"
summary: "Get the values for the provided header name."
parameters:
- description: "the name of the header whose value is being retrieved."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
syntax: "public String[] getValues(HttpHeaderName name)"
desc: "Get the values for the provided header name. null is returned if the header name isn't found.\n\nThis returns <xref uid=\"com.azure.core.http.HttpHeaders.getValue(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"getValue\"></xref> split by `comma`."
returns:
description: "the values of the header, or null if the header isn't found"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>[]"
- uid: "com.azure.core.http.HttpHeaders.getValues(java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.getValues(String name)"
name: "getValues(String name)"
nameWithType: "HttpHeaders.getValues(String name)"
summary: "Get the values for the provided header name."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.getValue(com.azure.core.http.HttpHeaderName)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getValue(HttpHeaderName)\"></xref> as it provides better performance."
parameters:
- description: "the name of the header whose value is being retrieved."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public String[] getValues(String name)"
desc: "Get the values for the provided header name. null is returned if the header name isn't found.\n\nThis returns <xref uid=\"com.azure.core.http.HttpHeaders.getValue(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"getValue\"></xref> split by `comma`."
hasDeprecatedTag: true
returns:
description: "the values of the header, or null if the header isn't found"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>[]"
- uid: "com.azure.core.http.HttpHeaders.iterator()"
fullName: "com.azure.core.http.HttpHeaders.iterator()"
name: "iterator()"
nameWithType: "HttpHeaders.iterator()"
syntax: "public Iterator<HttpHeader> iterator()"
returns:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html\">Iterator</a>&lt;<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.core.http.HttpHeaders.put(java.lang.String,java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.put(String name, String value)"
name: "put(String name, String value)"
nameWithType: "HttpHeaders.put(String name, String value)"
summary: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.set(com.azure.core.http.HttpHeaderName,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#set(HttpHeaderName, String)\"></xref> instead."
parameters:
- description: "the name"
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the value"
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeaders put(String name, String value)"
desc: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value.\n\nIf header with same name already exists then the value will be overwritten."
hasDeprecatedTag: true
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.remove(com.azure.core.http.HttpHeaderName)"
fullName: "com.azure.core.http.HttpHeaders.remove(HttpHeaderName name)"
name: "remove(HttpHeaderName name)"
nameWithType: "HttpHeaders.remove(HttpHeaderName name)"
summary: "Removes the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the provided header name."
parameters:
- description: "the name of the header to remove."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpHeader remove(HttpHeaderName name)"
desc: "Removes the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the provided header name. null is returned if the header isn't found."
returns:
description: "the header if removed, null otherwise."
type: "<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.remove(java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.remove(String name)"
name: "remove(String name)"
nameWithType: "HttpHeaders.remove(String name)"
summary: "Removes the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the provided header name."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.remove(com.azure.core.http.HttpHeaderName)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#remove(HttpHeaderName)\"></xref> as it provides better performance."
parameters:
- description: "the name of the header to remove."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeader remove(String name)"
desc: "Removes the <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the provided header name. null is returned if the header isn't found."
hasDeprecatedTag: true
returns:
description: "the header if removed, null otherwise."
type: "<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.set(com.azure.core.http.HttpHeaderName,java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.set(HttpHeaderName name, String value)"
name: "set(HttpHeaderName name, String value)"
nameWithType: "HttpHeaders.set(HttpHeaderName name, String value)"
summary: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value."
parameters:
- description: "the name to set in the header. If it is null, this method will return with no changes to the\n headers."
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
- description: "the value"
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public HttpHeaders set(HttpHeaderName name, String value)"
desc: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value. If a header with same name already exists then the value will be overwritten. If the given value is null, the header with the given name will be removed."
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.set(com.azure.core.http.HttpHeaderName,java.util.List<java.lang.String>)"
fullName: "com.azure.core.http.HttpHeaders.set(HttpHeaderName name, List<String> values)"
name: "set(HttpHeaderName name, List<String> values)"
nameWithType: "HttpHeaders.set(HttpHeaderName name, List<String> values)"
summary: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and the list of values provided, such that the given values will be comma-separated when necessary."
parameters:
- description: "the name"
name: "name"
type: "<xref href=\"com.azure.core.http.HttpHeaderName?alt=com.azure.core.http.HttpHeaderName&text=HttpHeaderName\" data-throw-if-not-resolved=\"False\" />"
- description: "the values that will be comma-separated as appropriate"
name: "values"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "public HttpHeaders set(HttpHeaderName name, List<String> values)"
desc: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and the list of values provided, such that the given values will be comma-separated when necessary. If a header with same name already exists then the values will be overwritten. If the given values list is null, the header with the given name will be removed."
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.set(java.lang.String,java.lang.String)"
fullName: "com.azure.core.http.HttpHeaders.set(String name, String value)"
name: "set(String name, String value)"
nameWithType: "HttpHeaders.set(String name, String value)"
summary: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.set(com.azure.core.http.HttpHeaderName,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#set(HttpHeaderName, String)\"></xref> as it provides better performance."
parameters:
- description: "the name to set in the header. If it is null, this method will return with no changes to the\n headers."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the value"
name: "value"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeaders set(String name, String value)"
desc: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and value. If a header with same name already exists then the value will be overwritten. If the given value is null, the header with the given name will be removed."
hasDeprecatedTag: true
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.set(java.lang.String,java.util.List<java.lang.String>)"
fullName: "com.azure.core.http.HttpHeaders.set(String name, List<String> values)"
name: "set(String name, List<String> values)"
nameWithType: "HttpHeaders.set(String name, List<String> values)"
summary: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and the list of values provided, such that the given values will be comma-separated when necessary."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.HttpHeaders.set(com.azure.core.http.HttpHeaderName,java.util.List<java.lang.String>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#set(HttpHeaderName, List)\"></xref> as it provides better performance."
parameters:
- description: "the name"
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "the values that will be comma-separated as appropriate"
name: "values"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public HttpHeaders set(String name, List<String> values)"
desc: "Sets a <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"header\"></xref> with the given name and the list of values provided, such that the given values will be comma-separated when necessary. If a header with same name already exists then the values will be overwritten. If the given values list is null, the header with the given name will be removed."
hasDeprecatedTag: true
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.setAll(java.util.Map<java.lang.String,java.util.List<java.lang.String>>)"
fullName: "com.azure.core.http.HttpHeaders.setAll(Map<String,List<String>> headers)"
name: "setAll(Map<String,List<String>> headers)"
nameWithType: "HttpHeaders.setAll(Map<String,List<String>> headers)"
summary: "Sets all provided header key/values pairs into this Http<wbr>Headers instance."
parameters:
- description: "a map containing keys representing header names, and keys representing the associated values."
name: "headers"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Map.html\">Map</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/List.html\">List</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;&gt;"
syntax: "public HttpHeaders setAll(Map<String,List<String>> headers)"
desc: "Sets all provided header key/values pairs into this HttpHeaders instance. This is equivalent to calling `headers.forEach(this::set)`, and therefore the behavior is as specified in <xref uid=\"com.azure.core.http.HttpHeaders.set(java.lang.String,java.util.List<java.lang.String>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#set(String, List)\"></xref>. In other words, this will create a header for each key in the provided map, replacing or removing an existing one, depending on the value. If the given values list is null, the header with the given name will be removed. If the given name is already a header, it will be removed and replaced with the headers provided.\n\nUse <xref uid=\"com.azure.core.http.HttpHeaders.setAllHttpHeaders(com.azure.core.http.HttpHeaders)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#setAllHttpHeaders(HttpHeaders)\"></xref> if you already have an instance of <xref uid=\"com.azure.core.http.HttpHeaders\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaders\"></xref> as it provides better performance."
returns:
description: "The updated HttpHeaders object"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.setAllHttpHeaders(com.azure.core.http.HttpHeaders)"
fullName: "com.azure.core.http.HttpHeaders.setAllHttpHeaders(HttpHeaders headers)"
name: "setAllHttpHeaders(HttpHeaders headers)"
nameWithType: "HttpHeaders.setAllHttpHeaders(HttpHeaders headers)"
summary: "Sets all headers from the passed `headers` into this <xref uid=\"com.azure.core.http.HttpHeaders\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaders\"></xref>."
parameters:
- description: "The headers to add into this <xref uid=\"com.azure.core.http.HttpHeaders\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaders\"></xref>."
name: "headers"
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpHeaders setAllHttpHeaders(HttpHeaders headers)"
desc: "Sets all headers from the passed `headers` into this <xref uid=\"com.azure.core.http.HttpHeaders\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeaders\"></xref>.\n\nThis is the equivalent to calling `headers.forEach(header -> set(header.getName(), header.getValuesList())` and therefore the behavior is as specified in <xref uid=\"com.azure.core.http.HttpHeaders.set(java.lang.String,java.util.List<java.lang.String>)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#set(String, List)\"></xref>.\n\nIf `headers` is null this is a no-op."
returns:
description: "The updated HttpHeaders object."
type: "<xref href=\"com.azure.core.http.HttpHeaders?alt=com.azure.core.http.HttpHeaders&text=HttpHeaders\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.http.HttpHeaders.stream()"
fullName: "com.azure.core.http.HttpHeaders.stream()"
name: "stream()"
nameWithType: "HttpHeaders.stream()"
summary: "Get a <xref uid=\"java.util.stream.Stream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Stream\"></xref> representation of the Http<wbr>Header values in this instance."
syntax: "public Stream<HttpHeader> stream()"
desc: "Get a <xref uid=\"java.util.stream.Stream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Stream\"></xref> representation of the HttpHeader values in this instance."
returns:
description: "A <xref uid=\"java.util.stream.Stream\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Stream\"></xref> of all header values in this instance."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html\">Stream</a>&lt;<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.core.http.HttpHeaders.toMap()"
fullName: "com.azure.core.http.HttpHeaders.toMap()"
name: "toMap()"
nameWithType: "HttpHeaders.toMap()"
summary: "Returns a copy of the http headers as an unmodifiable <xref uid=\"java.util.Map\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Map\"></xref> representation of the state of the headers at the time of the to<wbr>Map call."
syntax: "public Map<String,String> toMap()"
desc: "Returns a copy of the http headers as an unmodifiable <xref uid=\"java.util.Map\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Map\"></xref> representation of the state of the headers at the time of the toMap call. This map will not change as the underlying http headers change, and nor will modifying the key or values contained in the map have any effect on the state of the http headers.\n\nNote that there may be performance implications of using Map APIs on the returned Map. It is highly recommended that users prefer to use alternate APIs present on the HttpHeaders class, over using APIs present on the returned Map class. For example, use the <xref uid=\"com.azure.core.http.HttpHeaders.get(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#get(String)\"></xref> API, rather than `httpHeaders.toMap().get(name)`."
returns:
description: "the headers in a copied and unmodifiable form."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/util/Map.html\">Map</a>&lt;<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>,<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>&gt;"
- uid: "com.azure.core.http.HttpHeaders.toString()"
fullName: "com.azure.core.http.HttpHeaders.toString()"
name: "toString()"
nameWithType: "HttpHeaders.toString()"
overridden: "java.lang.Object.toString()"
syntax: "public String toString()"
returns:
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
type: "class"
desc: "Represents a collection of headers on an HTTP request or response.\n\nThis class encapsulates the headers of an HTTP request or response. It provides methods to add, set, get, and remove headers. It also provides methods to convert the headers to a Map, and to get a Stream representation of the headers.\n\nEach header is represented by an <xref uid=\"com.azure.core.http.HttpHeader\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpHeader\"></xref> instance, which encapsulates the name and value(s) of a header. If multiple values are associated with the same header name, they are stored in a single HttpHeader instance with values separated by commas.\n\nNote: Header names are case-insensitive."
implements:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html\">Iterable</a>&lt;<xref href=\"com.azure.core.http.HttpHeader?alt=com.azure.core.http.HttpHeader&text=HttpHeader\" data-throw-if-not-resolved=\"False\" />&gt;"
metadata: {}
package: "com.azure.core.http"
artifact: com.azure:azure-core:1.52.0