Package jakarta.ws.rs.core
Class NewCookie.AbstractNewCookieBuilder<T extends NewCookie.AbstractNewCookieBuilder<T>>
- java.lang.Object
- 
- jakarta.ws.rs.core.Cookie.AbstractCookieBuilder<NewCookie.AbstractNewCookieBuilder<T>>
- 
- jakarta.ws.rs.core.NewCookie.AbstractNewCookieBuilder<T>
 
 
- 
- Type Parameters:
- T- the current AbstractNewCookieBuilder type.
 - Direct Known Subclasses:
- NewCookie.Builder
 - Enclosing class:
- NewCookie
 
 public abstract static class NewCookie.AbstractNewCookieBuilder<T extends NewCookie.AbstractNewCookieBuilder<T>> extends Cookie.AbstractCookieBuilder<NewCookie.AbstractNewCookieBuilder<T>> JAX-RS abstractNewCookiebuilder class.- Since:
- 3.1
 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractNewCookieBuilder(Cookie cookie)Create a new instance supplementing the information in the supplied cookie.AbstractNewCookieBuilder(String name)Create a new instance.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract NewCookiebuild()Build a newNewCookieinstance using all the configuration previously specified in this builder.Tcomment(String comment)Set the comment associated with the cookie.Texpiry(Date expiry)Set the cookie expiry date.ThttpOnly(boolean httpOnly)Whether the cookie will only be visible as part of an HTTP request.TmaxAge(int maxAge)Set the maximum age of the the cookie in seconds.TsameSite(NewCookie.SameSite sameSite)Set the attribute that controls whether the cookie is sent with cross-origin requests, providing protection against cross-site request forgery.Tsecure(boolean secure)Whether the cookie will only be sent over a secure connection.- 
Methods inherited from class jakarta.ws.rs.core.Cookie.AbstractCookieBuilderdomain, path, value, version
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractNewCookieBuilderpublic AbstractNewCookieBuilder(String name) Create a new instance.- Parameters:
- name- the name of the cookie.
 
 - 
AbstractNewCookieBuilderpublic AbstractNewCookieBuilder(Cookie cookie) Create a new instance supplementing the information in the supplied cookie.- Parameters:
- cookie- the cookie to clone.
 
 
- 
 - 
Method Detail- 
commentpublic T comment(String comment) Set the comment associated with the cookie.- Parameters:
- comment- the comment.
- Returns:
- the updated builder instance.
 
 - 
maxAgepublic T maxAge(int maxAge) Set the maximum age of the the cookie in seconds. Cookies older than the maximum age are discarded. A cookie can be unset by sending a new cookie with maximum age of 0 since it will overwrite any existing cookie and then be immediately discarded. The default value of-1indicates that the cookie will be discarded at the end of the browser/application session.- Parameters:
- maxAge- the maximum age in seconds.
- Returns:
- the updated builder instance.
- See Also:
- expiry(Date)
 
 - 
expirypublic T expiry(Date expiry) Set the cookie expiry date. Cookies whose expiry date has passed are discarded. A cookie can be unset by setting a new cookie with an expiry date in the past, typically the lowest possible date that can be set.Note that it is recommended to use Max-Ageto control cookie expiration, however some browsers do not understandMax-Age, in which case settingExpiresparameter may be necessary.- Parameters:
- expiry- the cookie expiry date
- Returns:
- the updated builder instance.
- See Also:
- maxAge(int)
 
 - 
securepublic T secure(boolean secure) Whether the cookie will only be sent over a secure connection. Defaults tofalse.- Parameters:
- secure- specifies whether the cookie will only be sent over a secure connection.
- Returns:
- the updated builder instance.
 
 - 
httpOnlypublic T httpOnly(boolean httpOnly) Whether the cookie will only be visible as part of an HTTP request. Defaults tofalse.- Parameters:
- httpOnly- if- truemake the cookie HTTP only, i.e. only visible as part of an HTTP request.
- Returns:
- the updated builder instance.
 
 - 
sameSitepublic T sameSite(NewCookie.SameSite sameSite) Set the attribute that controls whether the cookie is sent with cross-origin requests, providing protection against cross-site request forgery.- Parameters:
- sameSite- specifies the value of the- SameSitecookie attribute.
- Returns:
- the updated builder instance.
 
 - 
buildpublic abstract NewCookie build() Build a newNewCookieinstance using all the configuration previously specified in this builder.- Specified by:
- buildin class- Cookie.AbstractCookieBuilder<NewCookie.AbstractNewCookieBuilder<T extends NewCookie.AbstractNewCookieBuilder<T>>>
- Returns:
- a new NewCookieinstance.
- Throws:
- IllegalArgumentException- if name is- null.
 
 
- 
 
-