Top Fields Constructors Methods
org.apache.catalina.core

public Class ApplicationSessionCookieConfig

extends Object
implements SessionCookieConfig
Class Inheritance
All Implemented Interfaces
jakarta.servlet.SessionCookieConfig
Imports
java.util.Collections, .Map, .TreeMap, jakarta.servlet.SessionCookieConfig, jakarta.servlet.http.Cookie, org.apache.catalina.Context, .LifecycleState, org.apache.catalina.util.SessionConfig, org.apache.tomcat.util.descriptor.web.Constants, org.apache.tomcat.util.res.StringManager

Field Summary

Modifier and TypeField and Description
private final Map<String, String>
private StandardContext
private static final boolean
private static final int
private static final boolean
private String
private static final StringManager
sm

The string manager for this package.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Cookie

Returns:

the cookie for the session
createSessionCookie
(Context
The Context for the web application
context
,
String
The ID of the session for which the cookie will be created
sessionId
,
boolean
Should session cookie be configured as secure
secure
)

Creates a new session cookie for the given session ID

public String
getAttribute(String
Name of attribute to return
name
)

Implements jakarta.servlet.SessionCookieConfig.getAttribute.

Obtain the value for a sesison cookie given attribute.

public Map<String, String>
getAttributes()

Implements jakarta.servlet.SessionCookieConfig.getAttributes.

Obtain the Map of attributes and values (excluding version) for this session cookie.

public String
getComment()

Implements jakarta.servlet.SessionCookieConfig.getComment.

With the adoption of support for RFC 6265, this method should no longer be used.

public String
getDomain()

Implements jakarta.servlet.SessionCookieConfig.getDomain.

Obtain the domain to use for session cookies.

public int
getMaxAge()

Implements jakarta.servlet.SessionCookieConfig.getMaxAge.

Obtain the maximum age to set for a session cookie.

public String
getName()

Implements jakarta.servlet.SessionCookieConfig.getName.

Obtain the name to use for the session cookies.

public String
getPath()

Implements jakarta.servlet.SessionCookieConfig.getPath.

Obtain the path to use for session cookies.

public boolean
isHttpOnly()

Implements jakarta.servlet.SessionCookieConfig.isHttpOnly.

Will session cookies be created with the httpOnly flag set?

public boolean
isSecure()

Implements jakarta.servlet.SessionCookieConfig.isSecure.

Will session cookies be created with the secure flag set?

public void
setAttribute(String
Name of attribute to set
name
,
String
Value of attribute
value
)

Implements jakarta.servlet.SessionCookieConfig.setAttribute.

Sets the value for the given session cookie attribute.

public void
setComment(String
Ignore
comment
)

Implements jakarta.servlet.SessionCookieConfig.setComment.

If called, this method has no effect.

public void
setDomain(String
The session cookie domain
domain
)

Implements jakarta.servlet.SessionCookieConfig.setDomain.

Sets the domain for the session cookie

public void
setHttpOnly(boolean
The httpOnly setting to use for session cookies
httpOnly
)

Implements jakarta.servlet.SessionCookieConfig.setHttpOnly.

Sets the httpOnly flag for the session cookie.

public void
setMaxAge(int
the maximum age to set
maxAge
)

Implements jakarta.servlet.SessionCookieConfig.setMaxAge.

Sets the maximum age.

public void
setName(String
The name of the session cookie
name
)

Implements jakarta.servlet.SessionCookieConfig.setName.

Sets the session cookie name.

public void
setPath(String
The session cookie path
path
)

Implements jakarta.servlet.SessionCookieConfig.setPath.

Sets the path of the session cookie.

public void
setSecure(boolean
The secure setting to use for session cookies
secure
)

Implements jakarta.servlet.SessionCookieConfig.setSecure.

Sets the secure flag for the session cookie.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributesback to summary
private final Map<String, String> attributes
contextback to summary
private StandardContext context
DEFAULT_HTTP_ONLYback to summary
private static final boolean DEFAULT_HTTP_ONLY
DEFAULT_MAX_AGEback to summary
private static final int DEFAULT_MAX_AGE
DEFAULT_SECUREback to summary
private static final boolean DEFAULT_SECURE
nameback to summary
private String name
smback to summary
private static final StringManager sm

The string manager for this package.

Constructor Detail

ApplicationSessionCookieConfigback to summary
public ApplicationSessionCookieConfig(StandardContext context)

Method Detail

createSessionCookieback to summary
public static Cookie createSessionCookie(Context context, String sessionId, boolean secure)

Creates a new session cookie for the given session ID

Parameters
context:Context

The Context for the web application

sessionId:String

The ID of the session for which the cookie will be created

secure:boolean

Should session cookie be configured as secure

Returns:Cookie

the cookie for the session

getAttributeback to summary
public String getAttribute(String name)

Implements jakarta.servlet.SessionCookieConfig.getAttribute.

Doc from jakarta.servlet.SessionCookieConfig.getAttribute.

Obtain the value for a sesison cookie given attribute. Values returned from this method must be consistent with the values set and returned by the attribute specific getters and setters in this class.

Parameters
name:String

Name of attribute to return

Returns:String

Value of specified attribute

Annotations
@Override
getAttributesback to summary
public Map<String, String> getAttributes()

Implements jakarta.servlet.SessionCookieConfig.getAttributes.

Doc from jakarta.servlet.SessionCookieConfig.getAttributes.

Obtain the Map of attributes and values (excluding version) for this session cookie.

Returns:Map<String, String>

A read-only Map of attributes to values, excluding version.

Annotations
@Override
getCommentback to summary
public String getComment()

Implements jakarta.servlet.SessionCookieConfig.getComment.

Doc from jakarta.servlet.SessionCookieConfig.getComment.

With the adoption of support for RFC 6265, this method should no longer be used.

Returns:String

always null

Annotations
@Override
getDomainback to summary
public String getDomain()

Implements jakarta.servlet.SessionCookieConfig.getDomain.

Doc from jakarta.servlet.SessionCookieConfig.getDomain.

Obtain the domain to use for session cookies.

Returns:String

the domain to use for session cookies.

Annotations
@Override
getMaxAgeback to summary
public int getMaxAge()

Implements jakarta.servlet.SessionCookieConfig.getMaxAge.

Doc from jakarta.servlet.SessionCookieConfig.getMaxAge.

Obtain the maximum age to set for a session cookie.

Returns:int

the maximum age in seconds

Annotations
@Override
getNameback to summary
public String getName()

Implements jakarta.servlet.SessionCookieConfig.getName.

Doc from jakarta.servlet.SessionCookieConfig.getName.

Obtain the name to use for the session cookies.

Returns:String

the name to use for session cookies.

Annotations
@Override
getPathback to summary
public String getPath()

Implements jakarta.servlet.SessionCookieConfig.getPath.

Doc from jakarta.servlet.SessionCookieConfig.getPath.

Obtain the path to use for session cookies. This is normally the context path.

Returns:String

The path to use for session cookies.

Annotations
@Override
isHttpOnlyback to summary
public boolean isHttpOnly()

Implements jakarta.servlet.SessionCookieConfig.isHttpOnly.

Doc from jakarta.servlet.SessionCookieConfig.isHttpOnly.

Will session cookies be created with the httpOnly flag set?

Returns:boolean

true if the flag should be set, otherwise false

Annotations
@Override
isSecureback to summary
public boolean isSecure()

Implements jakarta.servlet.SessionCookieConfig.isSecure.

Doc from jakarta.servlet.SessionCookieConfig.isSecure.

Will session cookies be created with the secure flag set?

Returns:boolean

true if the flag should be set, otherwise false

Annotations
@Override
setAttributeback to summary
public void setAttribute(String name, String value)

Implements jakarta.servlet.SessionCookieConfig.setAttribute.

Doc from jakarta.servlet.SessionCookieConfig.setAttribute.

Sets the value for the given session cookie attribute. When a value is set via this method, the value returned by the attribute specific getter (if any) must be consistent with the value set via this method.

Parameters
name:String

Name of attribute to set

value:String

Value of attribute

Annotations
@Override
setCommentback to summary
public void setComment(String comment)

Implements jakarta.servlet.SessionCookieConfig.setComment.

Doc from jakarta.servlet.SessionCookieConfig.setComment.

If called, this method has no effect.

Parameters
comment:String

Ignore

Annotations
@Override
setDomainback to summary
public void setDomain(String domain)

Implements jakarta.servlet.SessionCookieConfig.setDomain.

Doc from jakarta.servlet.SessionCookieConfig.setDomain.

Sets the domain for the session cookie

Parameters
domain:String

The session cookie domain

Annotations
@Override
setHttpOnlyback to summary
public void setHttpOnly(boolean httpOnly)

Implements jakarta.servlet.SessionCookieConfig.setHttpOnly.

Doc from jakarta.servlet.SessionCookieConfig.setHttpOnly.

Sets the httpOnly flag for the session cookie.

Parameters
httpOnly:boolean

The httpOnly setting to use for session cookies

Annotations
@Override
setMaxAgeback to summary
public void setMaxAge(int maxAge)

Implements jakarta.servlet.SessionCookieConfig.setMaxAge.

Doc from jakarta.servlet.SessionCookieConfig.setMaxAge.

Sets the maximum age.

Parameters
maxAge:int

the maximum age to set

Annotations
@Override
setNameback to summary
public void setName(String name)

Implements jakarta.servlet.SessionCookieConfig.setName.

Doc from jakarta.servlet.SessionCookieConfig.setName.

Sets the session cookie name.

Parameters
name:String

The name of the session cookie

Annotations
@Override
setPathback to summary
public void setPath(String path)

Implements jakarta.servlet.SessionCookieConfig.setPath.

Doc from jakarta.servlet.SessionCookieConfig.setPath.

Sets the path of the session cookie.

Parameters
path:String

The session cookie path

Annotations
@Override
setSecureback to summary
public void setSecure(boolean secure)

Implements jakarta.servlet.SessionCookieConfig.setSecure.

Doc from jakarta.servlet.SessionCookieConfig.setSecure.

Sets the secure flag for the session cookie.

Parameters
secure:boolean

The secure setting to use for session cookies

Annotations
@Override