# Class HttpHeaders (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.http.HttpHeaders)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.HttpHeaders)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.HttpHeaders)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.HttpHeaders)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.HttpHeaders)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.HttpHeaders)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.HttpHeaders)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.HttpHeaders)

    public class HttpHeaders extends GenericData

Stores HTTP headers used in an HTTP request or response, as defined in [Header Field Definitions](http://tools.ietf.org/html/rfc2616#section-14).

`null` is not allowed as a name or value of a header. Names are case-insensitive.

Implementation is not thread-safe.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [AbstractMap](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html) \> [GenericData](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData) \> HttpHeaders

## Inherited Members

[GenericData.clone()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_clone__) [GenericData.entrySet()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_entrySet__) [GenericData.equals(Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_equals_java_lang_Object_) [GenericData.get(Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_get_java_lang_Object_) [GenericData.getClassInfo()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_getClassInfo__) [GenericData.getUnknownKeys()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_getUnknownKeys__) [GenericData.hashCode()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_hashCode__) [GenericData.put(String,Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_put_java_lang_String_java_lang_Object_) [GenericData.putAll(Map\<? extends String,?\>)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_putAll_java_util_Map___extends_java_lang_String____) [GenericData.remove(Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_remove_java_lang_Object_) [GenericData.set(String,Object)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_set_java_lang_String_java_lang_Object_) [GenericData.setUnknownKeys(Map\<String,Object\>)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_setUnknownKeys_java_util_Map_java_lang_String_java_lang_Object__) [GenericData.toString()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_toString__) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) [AbstractMap.clear()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#clear--) [AbstractMap.containsKey(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsKey-java.lang.Object-) [AbstractMap.containsValue(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsValue-java.lang.Object-) [AbstractMap.isEmpty()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#isEmpty--) [AbstractMap.keySet()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#keySet--) [AbstractMap.put(K,V)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#put-K-V-) [AbstractMap.putAll(Map\<? extends K,? extends V\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#putAll-java.util.Map<? extends K-? extends V>-) [AbstractMap.size()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#size--) [AbstractMap.values()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#values--)

## Static Methods

### serializeHeadersForMultipartRequests(HttpHeaders headers, StringBuilder logbuf, Logger logger, Writer writer)

    public static void serializeHeadersForMultipartRequests(HttpHeaders headers, StringBuilder logbuf, Logger logger, Writer writer)

Serializes headers to an [Writer](https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html) for Multi-part requests.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `headers` | `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` HTTP headers |
| `logbuf` | `https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html` log buffer or `null` for none |
| `logger` | `https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html` logger or `null` for none. Logger must be specified if log buffer is specified |
| `writer` | `https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html` Writer where HTTP headers will be serialized to or `null` for none |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

## Constructors

### HttpHeaders()

    public HttpHeaders()

## Methods

### addWarning(String warning)

    public HttpHeaders addWarning(String warning)

Adds the `"Warning"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `warning` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### clone()

    public HttpHeaders clone()

Makes a "deep" clone of the generic data, in which the clone is completely independent of the
original.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

**Overrides** [GenericData.clone()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_clone__)

### fromHttpHeaders(HttpHeaders headers)

    public final void fromHttpHeaders(HttpHeaders headers)

Puts all headers of the [HttpHeaders](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders) object into this [HttpHeaders](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders) object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `headers` | `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` [HttpHeaders](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders) from where the headers are taken |

### fromHttpResponse(LowLevelHttpResponse response, StringBuilder logger)

    public final void fromHttpResponse(LowLevelHttpResponse response, StringBuilder logger)

Puts all headers of the [LowLevelHttpResponse](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.LowLevelHttpResponse) into this [HttpHeaders](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders) object.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `response` | `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.LowLevelHttpResponse` Response from which the headers are copied |
| `logger` | `https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html` [StringBuilder](https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html) to which logging output is added or `null` to disable logging |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### getAccept()

    public final String getAccept()

Returns the first `"Accept"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getAcceptEncoding()

    public final String getAcceptEncoding()

Returns the first `"Accept-Encoding"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getAge()

    public final Long getAge()

Returns the first `"Age"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` |   |

### getAuthenticate()

    public final String getAuthenticate()

Returns the first `"WWW-Authenticate"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getAuthenticateAsList()

    public final List<String> getAuthenticateAsList()

Returns all `"WWW-Authenticate"` headers or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getAuthorization()

    public final String getAuthorization()

Returns the first `"Authorization"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getAuthorizationAsList()

    public final List<String> getAuthorizationAsList()

Returns all `"Authorization"` headers or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getCacheControl()

    public final String getCacheControl()

Returns the first `"Cache-Control"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getContentEncoding()

    public final String getContentEncoding()

Returns the first `"Content-Encoding"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getContentLength()

    public final Long getContentLength()

Returns the first `"Content-Length"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` |   |

### getContentMD5()

    public final String getContentMD5()

Returns the first `"Content-MD5"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getContentRange()

    public final String getContentRange()

Returns the first `"Content-Range"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getContentType()

    public final String getContentType()

Returns the first `"Content-Type"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getCookie()

    public final String getCookie()

Returns the first `"Cookie"` header or `null` for none.

See [Cookie Specification.](http://tools.ietf.org/html/rfc6265)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getDate()

    public final String getDate()

Returns the first `"Date"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getETag()

    public final String getETag()

Returns the first `"ETag"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getExpires()

    public final String getExpires()

Returns the first `"Expires"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getFirstHeaderStringValue(String name)

    public String getFirstHeaderStringValue(String name)

Returns the first header string value for the given header name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` header name (may be any case) |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | first header string value or `null` if not found |

### getHeaderStringValues(String name)

    public List<String> getHeaderStringValues(String name)

Returns an unmodifiable list of the header string values for the given header name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` header name (may be any case) |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` | header string values or empty if not found |

### getIfMatch()

    public final String getIfMatch()

Returns the first `"If-Match"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getIfModifiedSince()

    public final String getIfModifiedSince()

Returns the first `"If-Modified-Since"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getIfNoneMatch()

    public final String getIfNoneMatch()

Returns the first `"If-None-Match"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getIfRange()

    public final String getIfRange()

Returns the first `"If-Range"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getIfUnmodifiedSince()

    public final String getIfUnmodifiedSince()

Returns the first `"If-Unmodified-Since"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getLastModified()

    public final String getLastModified()

Returns the first `"Last-Modified"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getLocation()

    public final String getLocation()

Returns the first `"Location"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getMimeVersion()

    public final String getMimeVersion()

Returns the first `"MIME-Version"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getRange()

    public final String getRange()

Returns the first `"Range"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getRetryAfter()

    public final String getRetryAfter()

Returns the first `"Retry-After"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getUserAgent()

    public final String getUserAgent()

Returns the first `"User-Agent"` header or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getWarning()

    public final List<String> getWarning()

Returns all `"Warning"` headers or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### set(String fieldName, Object value)

    public HttpHeaders set(String fieldName, Object value)

Sets the given field value (may be `null`) for the given field name. Any existing value
for the field will be overwritten. It may be more slightly more efficient than #put(String, Object) because it avoids accessing the field's original value.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

**Overrides** [GenericData.set(String fieldName, Object value)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.GenericData#com_google_api_client_util_GenericData_set_java_lang_String_java_lang_Object_)

### setAccept(String accept)

    public HttpHeaders setAccept(String accept)

Sets the `"Accept"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `accept` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setAcceptEncoding(String acceptEncoding)

    public HttpHeaders setAcceptEncoding(String acceptEncoding)

Sets the `"Accept-Encoding"` header or `null` for none.

By default, this is `"gzip"`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `acceptEncoding` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setAge(Long age)

    public HttpHeaders setAge(Long age)

Sets the `"Age"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `age` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setAuthenticate(String authenticate)

    public HttpHeaders setAuthenticate(String authenticate)

Sets the `"WWW-Authenticate"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `authenticate` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setAuthorization(String authorization)

    public HttpHeaders setAuthorization(String authorization)

Sets the `"Authorization"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `authorization` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setAuthorization(List\<String\> authorization)

    public HttpHeaders setAuthorization(List<String> authorization)

Sets the `"Authorization"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `authorization` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setBasicAuthentication(String username, String password)

    public HttpHeaders setBasicAuthentication(String username, String password)

Sets the #authorization header as specified in [Basic Authentication Scheme](http://tools.ietf.org/html/rfc2617#section-2).

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `username` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `password` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setCacheControl(String cacheControl)

    public HttpHeaders setCacheControl(String cacheControl)

Sets the `"Cache-Control"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cacheControl` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setContentEncoding(String contentEncoding)

    public HttpHeaders setContentEncoding(String contentEncoding)

Sets the `"Content-Encoding"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentEncoding` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setContentLength(Long contentLength)

    public HttpHeaders setContentLength(Long contentLength)

Sets the `"Content-Length"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentLength` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setContentMD5(String contentMD5)

    public HttpHeaders setContentMD5(String contentMD5)

Sets the `"Content-MD5"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentMD5` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setContentRange(String contentRange)

    public HttpHeaders setContentRange(String contentRange)

Sets the `"Content-Range"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentRange` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setContentType(String contentType)

    public HttpHeaders setContentType(String contentType)

Sets the `"Content-Type"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `contentType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setCookie(String cookie)

    public HttpHeaders setCookie(String cookie)

Sets the `"Cookie"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cookie` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setDate(String date)

    public HttpHeaders setDate(String date)

Sets the `"Date"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `date` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setETag(String etag)

    public HttpHeaders setETag(String etag)

Sets the `"ETag"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `etag` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setExpires(String expires)

    public HttpHeaders setExpires(String expires)

Sets the `"Expires"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `expires` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setIfMatch(String ifMatch)

    public HttpHeaders setIfMatch(String ifMatch)

Sets the `"If-Match"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ifMatch` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setIfModifiedSince(String ifModifiedSince)

    public HttpHeaders setIfModifiedSince(String ifModifiedSince)

Sets the `"If-Modified-Since"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ifModifiedSince` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setIfNoneMatch(String ifNoneMatch)

    public HttpHeaders setIfNoneMatch(String ifNoneMatch)

Sets the `"If-None-Match"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ifNoneMatch` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setIfRange(String ifRange)

    public HttpHeaders setIfRange(String ifRange)

Sets the `"If-Range"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ifRange` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setIfUnmodifiedSince(String ifUnmodifiedSince)

    public HttpHeaders setIfUnmodifiedSince(String ifUnmodifiedSince)

Sets the `"If-Unmodified-Since"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `ifUnmodifiedSince` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setLastModified(String lastModified)

    public HttpHeaders setLastModified(String lastModified)

Sets the `"Last-Modified"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `lastModified` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setLocation(String location)

    public HttpHeaders setLocation(String location)

Sets the `"Location"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `location` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setMimeVersion(String mimeVersion)

    public HttpHeaders setMimeVersion(String mimeVersion)

Sets the `"MIME-Version"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `mimeVersion` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setRange(String range)

    public HttpHeaders setRange(String range)

Sets the `"Range"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `range` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setRetryAfter(String retryAfter)

    public HttpHeaders setRetryAfter(String retryAfter)

Sets the `"Retry-After"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `retryAfter` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |

### setUserAgent(String userAgent)

    public HttpHeaders setUserAgent(String userAgent)

Sets the `"User-Agent"` header or `null` for none.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `userAgent` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpHeaders` |   |