An instance of this class is acquired by a call to ServletContext#getSessionCookieConfig.
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: Value of specified attributeName of attribute to return, case insensitive name)Obtain the value for a given session cookie attribute. |
| public Map | Returns: A read-only Map of attributes to values, excluding version.Obtain the Map (keys are case insensitive) of all attributes and values, including those set via the attribute specific setters, (excluding version) for this SessionCookieConfig. |
| public String | Returns: Alwaysnull
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 | |
| public int | Returns: 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)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. |
| public String | |
| public String | |
| public boolean | Returns: 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 otherwiseChecks 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. |
| public boolean | Returns: 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 secureChecks 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. |
| public void | setAttribute(String
Name of attribute to set, case insensitive 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
With the adoption of support for RFC 6265, this method should no longer be used. |
| public void | |
| public void | setHttpOnly(boolean
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 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. |
| public void | setMaxAge(int
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. 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. |
| public void | |
| public void | |
| public void | setSecure(boolean
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 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. |
| getAttribute | back to summary |
|---|---|
| public String getAttribute(String name) Obtain the value for a given session cookie 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. | |
| getAttributes | back to summary |
|---|---|
| public Map Obtain the Map (keys are case insensitive) of all attributes and values, including those set via the attribute specific setters, (excluding version) for this SessionCookieConfig. | |
| getComment | back 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.
| |
| getDomain | back to summary |
|---|---|
| public 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.
| |
| getMaxAge | back to summary |
|---|---|
| public 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. By default, -1 is returned.
| |
| getName | back to summary |
|---|---|
| public 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. By default, JSESSIONID will be used as the cookie name.
| |
| getPath | back to summary |
|---|---|
| public 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. By default, the context path of the ServletContext from which this SessionCookieConfig was acquired will be used.
| |
| isHttpOnly | back to summary |
|---|---|
| public 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.
| |
| isSecure | back to summary |
|---|---|
| public 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.
| |
| setAttribute | back 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.
| |
| setComment | back to summary |
|---|---|
| public void setComment(String comment)
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. If called, this method has no effect.
| |
| setDomain | back to summary |
|---|---|
| public 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.
| |
| setHttpOnly | back to summary |
|---|---|
| public 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. 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.
| |
| setMaxAge | back to summary |
|---|---|
| public 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.
| |
| setName | back to summary |
|---|---|
| public 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. 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.
| |
| setPath | back to summary |
|---|---|
| public 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.
| |
| setSecure | back to summary |
|---|---|
| public 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. 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.
| |