Package org.apache.catalina.core
Class ApplicationSessionCookieConfig
- java.lang.Object
-
- org.apache.catalina.core.ApplicationSessionCookieConfig
-
- All Implemented Interfaces:
SessionCookieConfig
public class ApplicationSessionCookieConfig extends Object implements SessionCookieConfig
-
-
Constructor Summary
Constructors Constructor Description ApplicationSessionCookieConfig(StandardContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CookiecreateSessionCookie(Context context, String sessionId, boolean secure)Creates a new session cookie for the given session IDStringgetComment()Obtain the comment to use for session cookies.StringgetDomain()Obtain the domain to use for session cookies.intgetMaxAge()Obtain the maximum age to set for a session cookie.StringgetName()Obtain the name to use for the session cookies.StringgetPath()Obtain the path to use for session cookies.booleanisHttpOnly()Will session cookies be created with the httpOnly flag set?booleanisSecure()Will session cookies be created with the secure flag set?voidsetComment(String comment)Sets the comment for the session cookievoidsetDomain(String domain)Sets the domain for the session cookievoidsetHttpOnly(boolean httpOnly)Sets the httpOnly flag for the session cookie.voidsetMaxAge(int maxAge)Sets the maximum age.voidsetName(String name)Sets the session cookie name.voidsetPath(String path)Sets the path of the session cookie.voidsetSecure(boolean secure)Sets the secure flag for the session cookie.
-
-
-
Constructor Detail
-
ApplicationSessionCookieConfig
public ApplicationSessionCookieConfig(StandardContext context)
-
-
Method Detail
-
getComment
public String getComment()
Description copied from interface:jakarta.servlet.SessionCookieConfigObtain the comment to use for session cookies.- Specified by:
getCommentin interfaceSessionCookieConfig- Returns:
- the comment to use for session cookies.
-
getDomain
public String getDomain()
Description copied from interface:jakarta.servlet.SessionCookieConfigObtain the domain to use for session cookies.- Specified by:
getDomainin interfaceSessionCookieConfig- Returns:
- the domain to use for session cookies.
-
getMaxAge
public int getMaxAge()
Description copied from interface:jakarta.servlet.SessionCookieConfigObtain the maximum age to set for a session cookie.- Specified by:
getMaxAgein interfaceSessionCookieConfig- Returns:
- the maximum age in seconds
-
getName
public String getName()
Description copied from interface:jakarta.servlet.SessionCookieConfigObtain the name to use for the session cookies.- Specified by:
getNamein interfaceSessionCookieConfig- Returns:
- the name to use for session cookies.
-
getPath
public String getPath()
Description copied from interface:jakarta.servlet.SessionCookieConfigObtain the path to use for session cookies. This is normally the context path.- Specified by:
getPathin interfaceSessionCookieConfig- Returns:
- The path to use for session cookies.
-
isHttpOnly
public boolean isHttpOnly()
Description copied from interface:jakarta.servlet.SessionCookieConfigWill session cookies be created with the httpOnly flag set?- Specified by:
isHttpOnlyin interfaceSessionCookieConfig- Returns:
trueif the flag should be set, otherwisefalse
-
isSecure
public boolean isSecure()
Description copied from interface:jakarta.servlet.SessionCookieConfigWill session cookies be created with the secure flag set?- Specified by:
isSecurein interfaceSessionCookieConfig- Returns:
trueif the flag should be set, otherwisefalse
-
setComment
public void setComment(String comment)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the comment for the session cookie- Specified by:
setCommentin interfaceSessionCookieConfig- Parameters:
comment- The session cookie comment
-
setDomain
public void setDomain(String domain)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the domain for the session cookie- Specified by:
setDomainin interfaceSessionCookieConfig- Parameters:
domain- The session cookie domain
-
setHttpOnly
public void setHttpOnly(boolean httpOnly)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the httpOnly flag for the session cookie.- Specified by:
setHttpOnlyin interfaceSessionCookieConfig- Parameters:
httpOnly- The httpOnly setting to use for session cookies
-
setMaxAge
public void setMaxAge(int maxAge)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the maximum age.- Specified by:
setMaxAgein interfaceSessionCookieConfig- Parameters:
maxAge- the maximum age to set
-
setName
public void setName(String name)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the session cookie name.- Specified by:
setNamein interfaceSessionCookieConfig- Parameters:
name- The name of the session cookie
-
setPath
public void setPath(String path)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the path of the session cookie.- Specified by:
setPathin interfaceSessionCookieConfig- Parameters:
path- The session cookie path
-
setSecure
public void setSecure(boolean secure)
Description copied from interface:jakarta.servlet.SessionCookieConfigSets the secure flag for the session cookie.- Specified by:
setSecurein interfaceSessionCookieConfig- Parameters:
secure- The secure setting to use for session cookies
-
createSessionCookie
public static Cookie createSessionCookie(Context context, String sessionId, boolean secure)
Creates a new session cookie for the given session ID- Parameters:
context- The Context for the web applicationsessionId- The ID of the session for which the cookie will be createdsecure- Should session cookie be configured as secure- Returns:
- the cookie for the session
-
-