Class AbstractNiceCookie
java.lang.Object
ch.tocco.nice2.web.core.api.servlet.AbstractNiceCookie
- Direct Known Subclasses:
AuthCookie, JwtCookie
An abstract cookie class to build a cookie and add it to a HttpServletResponse.
The javax.servlet.http.Cookie misses the functionality to set an exact expiration date, or to add a number of seconds based on the CLIENT's time.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNiceCookie(org.springframework.boot.web.server.Cookie.SameSite sameSiteMode, Boolean secure) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToResponse(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Adds the cookie to the response.protected abstract StringgetName()getSpecificTokens(jakarta.servlet.http.HttpServletRequest request) voidsetExpires(int seconds, org.joda.time.DateTime relativeToThisGmtDate) protected voidAllows to verify the current cookie configuration for SameSite and Secure combinations.
-
Field Details
-
-
sameSiteMode
protected org.springframework.boot.web.server.Cookie.SameSite sameSiteMode -
secure
-
addedToResponse
protected boolean addedToResponse -
expires
@Nullable protected @Nullable org.joda.time.DateTime expiresNull means it's a session cookie. Otherwise, the gmt date is passed on to the client.
-
-
Constructor Details
-
AbstractNiceCookie
protected AbstractNiceCookie(org.springframework.boot.web.server.Cookie.SameSite sameSiteMode, Boolean secure)
-
-
Method Details
-
setExpires
public void setExpires(int seconds, org.joda.time.DateTime relativeToThisGmtDate) - Parameters:
seconds- A number> 0.
-
addToResponse
public void addToResponse(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Adds the cookie to the response.This method may only be called once. Also, no more modification may be made to the class afterward.
-
verifyConfiguration
protected void verifyConfiguration()Allows to verify the current cookie configuration for SameSite and Secure combinations. -
getSpecificTokens
-
getName
-