类 MockCookie
java.lang.Object
jakarta.servlet.http.Cookie
cn.taketoday.mock.web.MockCookie
- 所有已实现的接口:
Serializable,Cloneable
public class MockCookie
extends jakarta.servlet.http.Cookie
Extension of
Cookie with extra attributes, as defined in
RFC 6265.- 从以下版本开始:
- 4.0
- 作者:
- Vedran Pavic, Juergen Hoeller, Sam Brannen
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private ZonedDateTimeprivate static final Stringprivate static final Stringprivate static final long -
构造器概要
构造器构造器说明MockCookie(String name, String value) Construct a newMockCookiewith the supplied name and value. -
方法概要
修饰符和类型方法说明private static StringextractAttributeValue(String attribute, String header) Get the "Expires" attribute for this cookie.Get the "SameSite" attribute for this cookie.static MockCookieFactory method that parses the value of the supplied "Set-Cookie" header.voidsetAttribute(String name, String value) voidsetExpires(ZonedDateTime expires) Set the "Expires" attribute for this cookie.voidsetSameSite(String sameSite) Set the "SameSite" attribute for this cookie.toString()从类继承的方法 jakarta.servlet.http.Cookie
clone, equals, getAttribute, getAttributes, getComment, getDomain, getMaxAge, getName, getPath, getSecure, getValue, getVersion, hashCode, isHttpOnly, setComment, setDomain, setHttpOnly, setMaxAge, setPath, setSecure, setValue, setVersion
-
字段详细资料
-
构造器详细资料
-
MockCookie
Construct a newMockCookiewith the supplied name and value.- 参数:
name- the namevalue- the value- 另请参阅:
-
Cookie(String, String)
-
-
方法详细资料
-
setExpires
Set the "Expires" attribute for this cookie. -
getExpires
Get the "Expires" attribute for this cookie.- 返回:
- the "Expires" attribute for this cookie, or
nullif not set
-
setSameSite
Set the "SameSite" attribute for this cookie.This limits the scope of the cookie such that it will only be attached to same-site requests if the supplied value is
"Strict"or cross-site requests if the supplied value is"Lax".- 另请参阅:
-
getSameSite
Get the "SameSite" attribute for this cookie.- 返回:
- the "SameSite" attribute for this cookie, or
nullif not set
-
parse
Factory method that parses the value of the supplied "Set-Cookie" header.- 参数:
setCookieHeader- the "Set-Cookie" value; nevernullor empty- 返回:
- the created cookie
-
extractAttributeValue
-
setAttribute
- 覆盖:
setAttribute在类中jakarta.servlet.http.Cookie
-
toString
- 覆盖:
toString在类中jakarta.servlet.http.Cookie
-