Package org.springframework.http

# Interface ResponseCookie.ResponseCookieBuilder

Enclosing class:
  ResponseCookie

public static interface ResponseCookie.ResponseCookieBuilder
A builder for a server-defined HttpCookie with attributes.

## Method Summary

Modifier and Type
Method
Description
`ResponseCookie`
`build()`
Create the HttpCookie.
`ResponseCookie.ResponseCookieBuilder`
`domain(String domain)`
Set the cookie "Domain" attribute.
`ResponseCookie.ResponseCookieBuilder`
`httpOnly(boolean httpOnly)`
Add the "HttpOnly" attribute to the cookie.
`ResponseCookie.ResponseCookieBuilder`
`maxAge(long maxAgeSeconds)`
Variant of `maxAge(Duration)` accepting a value in seconds.
`ResponseCookie.ResponseCookieBuilder`
`maxAge(Duration maxAge)`
Set the cookie "Max-Age" attribute.
`ResponseCookie.ResponseCookieBuilder`
`partitioned(boolean partitioned)`
Add the "Partitioned" attribute to the cookie.
`ResponseCookie.ResponseCookieBuilder`
`path(String path)`
Set the cookie "Path" attribute.
`ResponseCookie.ResponseCookieBuilder`
`sameSite(String sameSite)`
Add the "SameSite" attribute to the cookie.
`ResponseCookie.ResponseCookieBuilder`
`secure(boolean secure)`
Add the "Secure" attribute to the cookie.
`ResponseCookie.ResponseCookieBuilder`
`value(String value)`
Set the cookie value.

## Method Details

### value

ResponseCookie.ResponseCookieBuilder value(@Nullable String value)
Set the cookie value.

Since:
  6.0

### maxAge

ResponseCookie.ResponseCookieBuilder maxAge(Duration maxAge)
Set the cookie "Max-Age" attribute.

A positive value indicates when the cookie should expire relative to the current time. A value of 0 means the cookie should expire immediately. A negative value results in no "Max-Age" attribute in which case the cookie is removed when the browser is closed.

### maxAge

ResponseCookie.ResponseCookieBuilder maxAge(long maxAgeSeconds)
Variant of `maxAge(Duration)` accepting a value in seconds.

### path

ResponseCookie.ResponseCookieBuilder path(@Nullable String path)
Set the cookie "Path" attribute.

### domain

ResponseCookie.ResponseCookieBuilder domain(@Nullable String domain)
Set the cookie "Domain" attribute.

### secure

ResponseCookie.ResponseCookieBuilder secure(boolean secure)
Add the "Secure" attribute to the cookie.

### httpOnly

ResponseCookie.ResponseCookieBuilder httpOnly(boolean httpOnly)
Add the "HttpOnly" attribute to the cookie.

See Also:
  - https://owasp.org/www-community/HttpOnly

### partitioned

ResponseCookie.ResponseCookieBuilder partitioned(boolean partitioned)
Add the "Partitioned" attribute to the cookie.

Since:
  6.2
See Also:
  - The Partitioned attribute spec

### sameSite

ResponseCookie.ResponseCookieBuilder sameSite(@Nullable String sameSite)
Add the "SameSite" attribute to the cookie.

This limits the scope of the cookie such that it will only be attached to same site requests if `"Strict"` or cross-site requests if `"Lax"`.

Since:
  5.1
See Also:
  - RFC6265 bis

### build

ResponseCookie build()
Create the HttpCookie.