Interface ApplicationCookieService
- All Known Implementing Classes:
StandardApplicationCookieService,StandardCookieCsrfTokenRepository.CsrfApplicationCookieService
public interface ApplicationCookieService
Application Cookie Service capable of generating and retrieving HTTP Cookies using standard properties
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName, String value) Generate cookie with specified valuevoidaddSessionCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName, String value) Generate cookie with session-based expiration and specified valuegetCookieValue(jakarta.servlet.http.HttpServletRequest request, ApplicationCookieName applicationCookieName) Get cookie value using specified namevoidremoveCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName) Generate cookie with an empty value instructing the client to remove the cookie
-
Method Details
-
addCookie
void addCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName, String value) Generate cookie with specified value- Parameters:
resourceUri- Resource URI containing path and domainresponse- HTTP Servlet ResponseapplicationCookieName- Application Cookie Name to be addedvalue- Cookie value to be added
-
addSessionCookie
void addSessionCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName, String value) Generate cookie with session-based expiration and specified value- Parameters:
resourceUri- Resource URI containing path and domainresponse- HTTP Servlet ResponseapplicationCookieName- Application Cookie Namevalue- Cookie value to be added
-
getCookieValue
Optional<String> getCookieValue(jakarta.servlet.http.HttpServletRequest request, ApplicationCookieName applicationCookieName) Get cookie value using specified name- Parameters:
request- HTTP Servlet ResponseapplicationCookieName- Application Cookie Name to be retrieved- Returns:
- Optional Cookie Value
-
removeCookie
void removeCookie(URI resourceUri, jakarta.servlet.http.HttpServletResponse response, ApplicationCookieName applicationCookieName) Generate cookie with an empty value instructing the client to remove the cookie- Parameters:
resourceUri- Resource URI containing path and domainresponse- HTTP Servlet ResponseapplicationCookieName- Application Cookie Name to be removed
-