接口 CookieSameSiteSupplier
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
Strategy interface that can be used with
ConfigurableServletWebServerFactory
implementations in order to supply custom Cookie.SameSite values for specific
cookies.
Basic CookieSameSiteSupplier implementations can be constructed using the of...
factory methods, typically combined with name matching. For example:
CookieSameSiteSupplier.ofLax().whenHasName("mycookie");
- 从以下版本开始:
- 2.6.0
- 作者:
- Phillip Webb
- 另请参阅:
-
方法概要
修饰符和类型方法说明getSameSite(Cookie cookie) Get theCookie.SameSitevalues that should be used for the givenCookie.static CookieSameSiteSupplierof(Cookie.SameSite sameSite) Return a newCookieSameSiteSupplierthat always returns the givenCookie.SameSitevalue.static CookieSameSiteSupplierofLax()Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.LAX.static CookieSameSiteSupplierofNone()Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.NONE.static CookieSameSiteSupplierofStrict()Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.STRICT.default CookieSameSiteSupplierLimit this supplier so that it's only called if the predicate accepts the Cookie.default CookieSameSiteSupplierwhenHasName(String name) Limit this supplier so that it's only called if the Cookie has the given name.default CookieSameSiteSupplierwhenHasName(Supplier<String> nameSupplier) Limit this supplier so that it's only called if the Cookie has the given name.default CookieSameSiteSupplierwhenHasNameMatching(String regex) Limit this supplier so that it's only called if the Cookie name matches the given regex.default CookieSameSiteSupplierwhenHasNameMatching(Pattern pattern) Limit this supplier so that it's only called if the Cookie name matches the givenPattern.
-
方法详细资料
-
getSameSite
Get theCookie.SameSitevalues that should be used for the givenCookie.- 参数:
cookie- the cookie to check- 返回:
- the
Cookie.SameSitevalue to use ornullif the next supplier should be checked
-
whenHasName
Limit this supplier so that it's only called if the Cookie has the given name.- 参数:
name- the name to check- 返回:
- a new
CookieSameSiteSupplierthat only calls this supplier when the name matches
-
whenHasName
Limit this supplier so that it's only called if the Cookie has the given name.- 参数:
nameSupplier- a supplier providing the name to check- 返回:
- a new
CookieSameSiteSupplierthat only calls this supplier when the name matches
-
whenHasNameMatching
Limit this supplier so that it's only called if the Cookie name matches the given regex.- 参数:
regex- the regex pattern that must match- 返回:
- a new
CookieSameSiteSupplierthat only calls this supplier when the name matches the regex
-
whenHasNameMatching
Limit this supplier so that it's only called if the Cookie name matches the givenPattern.- 参数:
pattern- the regex pattern that must match- 返回:
- a new
CookieSameSiteSupplierthat only calls this supplier when the name matches the pattern
-
when
Limit this supplier so that it's only called if the predicate accepts the Cookie.- 参数:
predicate- the predicate used to match the cookie- 返回:
- a new
CookieSameSiteSupplierthat only calls this supplier when the cookie matches the predicate
-
ofNone
Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.NONE.- 返回:
- the supplier instance
-
ofLax
Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.LAX.- 返回:
- the supplier instance
-
ofStrict
Return a newCookieSameSiteSupplierthat always returnsCookie.SameSite.STRICT.- 返回:
- the supplier instance
-
of
Return a newCookieSameSiteSupplierthat always returns the givenCookie.SameSitevalue.- 参数:
sameSite- the value to return- 返回:
- the supplier instance
-