com.amazonaws.services.cloudfront.model

## Class Headers

- java.lang.Object
- - com.amazonaws.services.cloudfront.model.Headers

All Implemented Interfaces:
  Serializable, Cloneable

    public class Headers
    extends Object
    implements Serializable, Cloneable

A complex type that specifies the headers that you want CloudFront to forward to the origin for this cache behavior.

For the headers that you specify, CloudFront also caches separate versions of a specified object based on the header values in viewer requests. For example, suppose viewer requests for `logo.jpg` contain a custom `Product` header that has a value of either `Acme` or `Apex`, and you configure CloudFront to cache your content based on values in the `Product` header. CloudFront forwards the `Product` header to the origin and caches the response from the origin once for each header value. For more information about caching based on header values, see How CloudFront Forwards and Caches Headers in the Amazon CloudFront Developer Guide.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`Headers()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Headers` `clone()`
`boolean` `equals(Object obj)`
`List<String>` `getItems()` A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior.
`Integer` `getQuantity()` The number of different headers that you want CloudFront to forward to the origin for this cache behavior.
`int` `hashCode()`
`void` `setItems(Collection<String> items)` A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior.
`void` `setQuantity(Integer quantity)` The number of different headers that you want CloudFront to forward to the origin for this cache behavior.
`String` `toString()` Returns a string representation of this object; useful for testing and debugging.
`Headers` `withItems(Collection<String> items)` A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior.
`Headers` `withItems(String... items)` A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior.
`Headers` `withQuantity(Integer quantity)` The number of different headers that you want CloudFront to forward to the origin for this cache behavior.

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Headers

    public Headers()

### Method Detail

#### setQuantity

    public void setQuantity(Integer quantity)

The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

- Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

  <important>

  If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

  </important>

- Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

- Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

Parameters:
  `quantity` - The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

  - Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

    <important>

    If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

    </important>

  - Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

  - Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

#### getQuantity

    public Integer getQuantity()

The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

- Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

  <important>

  If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

  </important>

- Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

- Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

Returns:
  The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

  - Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

    <important>

    If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

    </important>

  - Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

  - Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

#### withQuantity

    public Headers withQuantity(Integer quantity)

The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

- Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

  <important>

  If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

  </important>

- Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

- Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

Parameters:
  `quantity` - The number of different headers that you want CloudFront to forward to the origin for this cache behavior. You can configure each cache behavior in a web distribution to do one of the following:

  - Forward all headers to your origin: Specify `1` for `Quantity` and `*` for `Name`.

    <important>

    If you configure CloudFront to forward all headers to your origin, CloudFront doesn't cache the objects associated with this cache behavior. Instead, it sends every request to the origin.

    </important>

  - Forward a whitelist of headers you specify: Specify the number of headers that you want to forward, and specify the header names in `Name` elements. CloudFront caches your objects based on the values in all of the specified headers. CloudFront also forwards the headers that it forwards by default, but it caches your objects based only on the headers that you specify.

  - Forward only the default headers: Specify `0` for `Quantity` and omit `Items`. In this configuration, CloudFront doesn't cache based on the values in the request headers.

Returns:
  Returns a reference to this object so that method calls can be chained together.

#### getItems

    public List<String> getItems()

A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

Returns:
  A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

#### setItems

    public void setItems(Collection<String> items)

A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

Parameters:
  `items` - A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

#### withItems

    public Headers withItems(String... items)

A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

NOTE: This method appends the values to the existing list (if any). Use `setItems(java.util.Collection)` or `withItems(java.util.Collection)` if you want to override the existing values.

Parameters:
  `items` - A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.
Returns:
  Returns a reference to this object so that method calls can be chained together.

#### withItems

    public Headers withItems(Collection<String> items)

A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.

Parameters:
  `items` - A complex type that contains one `Name` element for each header that you want CloudFront to forward to the origin and to vary on for this cache behavior. If `Quantity` is `0`, omit `Items`.
Returns:
  Returns a reference to this object so that method calls can be chained together.

#### toString

    public String toString()

Returns a string representation of this object; useful for testing and debugging.

Overrides:
  `toString` in class `Object`
Returns:
  A string representation of this object.
See Also:
  `Object.toString()`

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### clone

    public Headers clone()

Overrides:
  `clone` in class `Object`