类 MockSessionCookieConfig
- java.lang.Object
- org.springframework.mock.web.MockSessionCookieConfig
- 所有已实现的接口:
SessionCookieConfig
public class MockSessionCookieConfig extends Object implements SessionCookieConfig
Mock implementation of theSessionCookieConfig
interface.- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
ServletContext.getSessionCookieConfig()
构造器概要
构造器 构造器 说明 MockSessionCookieConfig()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
getComment()
Gets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.String
getDomain()
Gets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.int
getMaxAge()
Gets the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.String
getName()
Gets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.String
getPath()
Gets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.boolean
isHttpOnly()
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as HttpOnly.boolean
isSecure()
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as secure even if the request that initiated the corresponding session is using plain HTTP instead of HTTPS.void
setComment(String comment)
Sets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.void
setDomain(String domain)
Sets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.void
setHttpOnly(boolean httpOnly)
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as HttpOnly.void
setMaxAge(int maxAge)
Sets the lifetime (in seconds) for the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.void
setName(String name)
Sets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.void
setPath(String path)
Sets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.void
setSecure(boolean secure)
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as secure.
构造器详细资料
MockSessionCookieConfig
public MockSessionCookieConfig()
方法详细资料
setName
public void setName(@Nullable String name)
从接口复制的说明:javax.servlet.SessionCookieConfig
Sets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.NOTE: Changing the name of session tracking cookies may break other tiers (for example, a load balancing frontend) that assume the cookie name to be equal to the default JSESSIONID, and therefore should only be done cautiously.
- 指定者:
setName
在接口中SessionCookieConfig
- 参数:
name
- the cookie name to use
getName
@Nullable public String getName()
从接口复制的说明:javax.servlet.SessionCookieConfig
Gets the name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.By default, JSESSIONID will be used as the cookie name.
- 指定者:
getName
在接口中SessionCookieConfig
- 返回:
- the cookie name set via
SessionCookieConfig.setName(java.lang.String)
, or null ifSessionCookieConfig.setName(java.lang.String)
was never called - 另请参阅:
Cookie.getName()
setDomain
public void setDomain(@Nullable String domain)
从接口复制的说明:javax.servlet.SessionCookieConfig
Sets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 指定者:
setDomain
在接口中SessionCookieConfig
- 参数:
domain
- the cookie domain to use- 另请参阅:
Cookie.setDomain(String)
getDomain
@Nullable public String getDomain()
从接口复制的说明:javax.servlet.SessionCookieConfig
Gets the domain name that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 指定者:
getDomain
在接口中SessionCookieConfig
- 返回:
- the cookie domain set via
SessionCookieConfig.setDomain(java.lang.String)
, or null ifSessionCookieConfig.setDomain(java.lang.String)
was never called - 另请参阅:
Cookie.getDomain()
setPath
public void setPath(@Nullable String path)
从接口复制的说明:javax.servlet.SessionCookieConfig
Sets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 指定者:
setPath
在接口中SessionCookieConfig
- 参数:
path
- the cookie path to use- 另请参阅:
Cookie.setPath(String)
getPath
@Nullable public String getPath()
从接口复制的说明:javax.servlet.SessionCookieConfig
Gets the path that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.By default, the context path of the ServletContext from which this SessionCookieConfig was acquired will be used.
- 指定者:
getPath
在接口中SessionCookieConfig
- 返回:
- the cookie path set via
SessionCookieConfig.setPath(java.lang.String)
, or null ifSessionCookieConfig.setPath(java.lang.String)
was never called - 另请参阅:
Cookie.getPath()
setComment
public void setComment(@Nullable String comment)
从接口复制的说明:javax.servlet.SessionCookieConfig
Sets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.As a side effect of this call, the session tracking cookies will be marked with a
Version
attribute equal to1
.- 指定者:
setComment
在接口中SessionCookieConfig
- 参数:
comment
- the cookie comment to use- 另请参阅:
Cookie.setComment(String)
,Cookie.getVersion()
getComment
@Nullable public String getComment()
从接口复制的说明:javax.servlet.SessionCookieConfig
Gets the comment that will be assigned to any session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 指定者:
getComment
在接口中SessionCookieConfig
- 返回:
- the cookie comment set via
SessionCookieConfig.setComment(java.lang.String)
, or null ifSessionCookieConfig.setComment(java.lang.String)
was never called - 另请参阅:
Cookie.getComment()
setHttpOnly
public void setHttpOnly(boolean httpOnly)
从接口复制的说明:javax.servlet.SessionCookieConfig
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as HttpOnly.A cookie is marked as HttpOnly by adding the HttpOnly attribute to it. HttpOnly cookies are not supposed to be exposed to client-side scripting code, and may therefore help mitigate certain kinds of cross-site scripting attacks.
- 指定者:
setHttpOnly
在接口中SessionCookieConfig
- 参数:
httpOnly
- true if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired shall be marked as HttpOnly, false otherwise- 另请参阅:
Cookie.setHttpOnly(boolean)
isHttpOnly
public boolean isHttpOnly()
从接口复制的说明:javax.servlet.SessionCookieConfig
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as HttpOnly.- 指定者:
isHttpOnly
在接口中SessionCookieConfig
- 返回:
- true if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as HttpOnly, false otherwise
- 另请参阅:
Cookie.isHttpOnly()
setSecure
public void setSecure(boolean secure)
从接口复制的说明:javax.servlet.SessionCookieConfig
Marks or unmarks the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired as secure.One use case for marking a session tracking cookie as secure, even though the request that initiated the session came over HTTP, is to support a topology where the web container is front-ended by an SSL offloading load balancer. In this case, the traffic between the client and the load balancer will be over HTTPS, whereas the traffic between the load balancer and the web container will be over HTTP.
- 指定者:
setSecure
在接口中SessionCookieConfig
- 参数:
secure
- true if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired shall be marked as secure even if the request that initiated the corresponding session is using plain HTTP instead of HTTPS, and false if they shall be marked as secure only if the request that initiated the corresponding session was also secure- 另请参阅:
Cookie.setSecure(boolean)
,ServletRequest.isSecure()
isSecure
public boolean isSecure()
从接口复制的说明:javax.servlet.SessionCookieConfig
Checks if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as secure even if the request that initiated the corresponding session is using plain HTTP instead of HTTPS.- 指定者:
isSecure
在接口中SessionCookieConfig
- 返回:
- true if the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired will be marked as secure even if the request that initiated the corresponding session is using plain HTTP instead of HTTPS, and false if they will be marked as secure only if the request that initiated the corresponding session was also secure
- 另请参阅:
Cookie.getSecure()
,ServletRequest.isSecure()
setMaxAge
public void setMaxAge(int maxAge)
从接口复制的说明:javax.servlet.SessionCookieConfig
Sets the lifetime (in seconds) for the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 指定者:
setMaxAge
在接口中SessionCookieConfig
- 参数:
maxAge
- the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.- 另请参阅:
Cookie.setMaxAge(int)
getMaxAge
public int getMaxAge()
从接口复制的说明:javax.servlet.SessionCookieConfig
Gets the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired.By default, -1 is returned.
- 指定者:
getMaxAge
在接口中SessionCookieConfig
- 返回:
- the lifetime (in seconds) of the session tracking cookies created on behalf of the application represented by the ServletContext from which this SessionCookieConfig was acquired, or -1 (the default)
- 另请参阅:
Cookie.getMaxAge()