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
Modifier and TypeFieldDescriptionprotected boolean
protected @Nullable String
protected @Nullable org.joda.time.DateTime
Null means it's a session cookie. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToResponse
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Adds the cookie to the response.protected abstract String
getName()
getSpecificTokens
(jakarta.servlet.http.HttpServletRequest request) void
setExpires
(int seconds, org.joda.time.DateTime relativeToThisGmtDate) protected abstract boolean
shouldBeSecured
(jakarta.servlet.http.HttpServletRequest request)
-
Field Details
-
-
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
public AbstractNiceCookie()
-
-
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 afterwards.
-
getSpecificTokens
-
getName
-
shouldBeSecured
protected abstract boolean shouldBeSecured(jakarta.servlet.http.HttpServletRequest request)
-