Top Description Methods
jakarta.servlet

public Interface SessionCookieConfig

Known Direct Implementers
org.apache.catalina.core.ApplicationSessionCookieConfig
Imports
java.util.Map

Configures the session cookies used by the web application associated with the ServletContext from which this SessionCookieConfig was obtained.
Since
Servlet 3.0

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

Value of specified attribute
getAttribute
(String
Name of attribute to return
name
)

Obtain the value for a sesison cookie given attribute.

public Map<String, String>

Returns:

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

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

public String

Returns:

always null
getComment
()
Deprecated for removal since Servlet 6.0. This is no longer required with RFC 6265

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

public String

Returns:

the domain to use for session cookies.
getDomain
()

Obtain the domain to use for session cookies.

public int

Returns:

the maximum age in seconds
getMaxAge
()

Obtain the maximum age to set for a session cookie.

public String

Returns:

the name to use for session cookies.
getName
()

Obtain the name to use for the session cookies.

public String

Returns:

The path to use for session cookies.
getPath
()

Obtain the path to use for session cookies.

public boolean

Returns:

true if the flag should be set, otherwise false
isHttpOnly
()

Will session cookies be created with the httpOnly flag set?

public boolean

Returns:

true if the flag should be set, otherwise false
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
)

Sets the value for the given session cookie attribute.

public void
setComment(String
Ignore
comment
)
Deprecated for removal since Servlet 6.0. This is no longer required with RFC 6265

If called, this method has no effect.

public void
setDomain(String
The session cookie domain
domain
)

Sets the domain for the session cookie

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

Sets the httpOnly flag for the session cookie.

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

Sets the maximum age.

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

Sets the session cookie name.

public void
setPath(String
The session cookie path
path
)

Sets the path of the session cookie.

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

Sets the secure flag for the session cookie.

Method Detail

getAttributeback to summary
public String getAttribute(String name)

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

Since
Servlet 6.0
getAttributesback to summary
public Map<String, String> 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.

Since
Servlet 6.0
getCommentback to summary
public String getComment()

Deprecated

for removal since Servlet 6.0.

This is no longer required with RFC 6265

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

Returns:String

always null

Annotations
@Deprecated
since:Servlet 6.0
forRemoval:true
getDomainback to summary
public String getDomain()

Obtain the domain to use for session cookies.

Returns:String

the domain to use for session cookies.

getMaxAgeback to summary
public int getMaxAge()

Obtain the maximum age to set for a session cookie.

Returns:int

the maximum age in seconds

getNameback to summary
public String getName()

Obtain the name to use for the session cookies.

Returns:String

the name to use for session cookies.

getPathback to summary
public String getPath()

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

Returns:String

The path to use for session cookies.

isHttpOnlyback to summary
public boolean isHttpOnly()

Will session cookies be created with the httpOnly flag set?

Returns:boolean

true if the flag should be set, otherwise false

isSecureback to summary
public boolean isSecure()

Will session cookies be created with the secure flag set?

Returns:boolean

true if the flag should be set, otherwise false

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

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

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
IllegalArgumentException:
If the attribute name is null or contains any characters not permitted for use in Cookie names.
NumberFormatException:
If the attribute is known to be numerical but the provided value cannot be parsed to a number.
Since
Servlet 6.0
setCommentback to summary
public void setComment(String comment)

Deprecated

for removal since Servlet 6.0.

This is no longer required with RFC 6265

If called, this method has no effect.

Parameters
comment:String

Ignore

Annotations
@Deprecated
since:Servlet 6.0
forRemoval:true
Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setDomainback to summary
public void setDomain(String domain)

Sets the domain for the session cookie

Parameters
domain:String

The session cookie domain

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setHttpOnlyback to summary
public void setHttpOnly(boolean httpOnly)

Sets the httpOnly flag for the session cookie.

Parameters
httpOnly:boolean

The httpOnly setting to use for session cookies

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setMaxAgeback to summary
public void setMaxAge(int MaxAge)

Sets the maximum age.

Parameters
MaxAge:int

the maximum age to set

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setNameback to summary
public void setName(String name)

Sets the session cookie name.

Parameters
name:String

The name of the session cookie

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setPathback to summary
public void setPath(String path)

Sets the path of the session cookie.

Parameters
path:String

The session cookie path

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised
setSecureback to summary
public void setSecure(boolean secure)

Sets the secure flag for the session cookie.

Parameters
secure:boolean

The secure setting to use for session cookies

Exceptions
IllegalStateException:
if the associated ServletContext has already been initialised