SSLSessionContext
Stay organized with collections
Save and categorize content based on your preferences.
A SSLSessionContext
represents a set of
SSLSession
s associated with a single entity. For example,
it could be associated with a server or client who participates in many
sessions concurrently.
Not all environments will contain session contexts.
There are SSLSessionContext
parameters that affect how
sessions are stored:
- Sessions can be set to expire after a specified
time limit.
- The number of sessions that can be stored in context
can be limited.
A session can be retrieved based on its session id, and all session id's
in a
SSLSessionContext
can be listed.
Public Method Summary
abstract
Enumeration<byte[]>
|
getIds()
Returns an Enumeration of all session id's grouped under this
SSLSessionContext .
|
abstract
SSLSession
|
getSession(byte[] sessionId)
Returns the SSLSession bound to the specified session id.
|
abstract
int
|
getSessionCacheSize()
Returns the size of the cache used for storing
SSLSession objects grouped under this
SSLSessionContext .
|
abstract
int
|
getSessionTimeout()
Returns the timeout limit of SSLSession objects grouped
under this SSLSessionContext .
|
abstract
void
|
setSessionCacheSize(int size)
Sets the size of the cache used for storing
SSLSession objects grouped under this
SSLSessionContext .
|
abstract
void
|
setSessionTimeout(int seconds)
Sets the timeout limit for SSLSession objects grouped
under this SSLSessionContext .
|
Public Methods
public
abstract
Enumeration<byte[]>
getIds
()
Returns an Enumeration of all session id's grouped under this
SSLSessionContext
.
Returns
- an enumeration of all the Session id's
public
abstract
SSLSession
getSession
(byte[] sessionId)
Returns the SSLSession
bound to the specified session id.
Parameters
sessionId |
the Session identifier |
Returns
- the
SSLSession
or null if
the specified session id does not refer to a valid SSLSession.
public
abstract
int
getSessionCacheSize
()
Returns the size of the cache used for storing
SSLSession
objects grouped under this
SSLSessionContext
.
Returns
- size of the session cache; zero means there is no size limit.
public
abstract
int
getSessionTimeout
()
Returns the timeout limit of SSLSession
objects grouped
under this SSLSessionContext
.
If the timeout limit is set to 't' seconds, a session exceeds the
timeout limit 't' seconds after its creation time.
When the timeout limit is exceeded for a session, the
SSLSession
object is invalidated and future connections
cannot resume or rejoin the session.
A check for sessions exceeding the timeout limit is made immediately
whenever the timeout limit is changed for this
SSLSessionContext
.
Returns
- the session timeout limit in seconds; zero means there is no
limit.
public
abstract
void
setSessionCacheSize
(int size)
Sets the size of the cache used for storing
SSLSession
objects grouped under this
SSLSessionContext
.
Parameters
size |
the new session cache size limit; zero means there is no
limit. |
public
abstract
void
setSessionTimeout
(int seconds)
Sets the timeout limit for SSLSession
objects grouped
under this SSLSessionContext
.
If the timeout limit is set to 't' seconds, a session exceeds the
timeout limit 't' seconds after its creation time.
When the timeout limit is exceeded for a session, the
SSLSession
object is invalidated and future connections
cannot resume or rejoin the session.
A check for sessions exceeding the timeout is made immediately whenever
the timeout limit is changed for this SSLSessionContext
.
Parameters
seconds |
the new session timeout limit in seconds; zero means
there is no limit. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eSSLSessionContext\u003c/code\u003e stores and manages multiple \u003ccode\u003eSSLSession\u003c/code\u003es, often associated with a server or client involved in concurrent sessions.\u003c/p\u003e\n"],["\u003cp\u003eSession storage is customizable, allowing for expiration time limits and maximum session counts.\u003c/p\u003e\n"],["\u003cp\u003eSessions can be retrieved using their unique session IDs, and all IDs within the context are accessible.\u003c/p\u003e\n"],["\u003cp\u003eNot all environments support session contexts, so availability should be considered.\u003c/p\u003e\n"]]],[],null,["public interface **SSLSessionContext** \nA `SSLSessionContext` represents a set of\n`SSLSession`s associated with a single entity. For example,\nit could be associated with a server or client who participates in many\nsessions concurrently.\n\n\nNot all environments will contain session contexts.\n\n\nThere are `SSLSessionContext` parameters that affect how\nsessions are stored:\n\n- Sessions can be set to expire after a specified time limit.\n- The number of sessions that can be stored in context can be limited.\n\nA session can be retrieved based on its session id, and all session id's in a `SSLSessionContext` can be listed.\n\n\u003cbr /\u003e\n\nSee Also\n\n- [SSLSession](../../../../reference/javax/net/ssl/SSLSession.html) \n\nPublic Method Summary\n\n|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Enumeration](../../../../reference/java/util/Enumeration.html)\\\u003cbyte\\[\\]\\\u003e | [getIds](../../../../reference/javax/net/ssl/SSLSessionContext.html#getIds())() Returns an Enumeration of all session id's grouped under this `SSLSessionContext`. |\n| abstract [SSLSession](../../../../reference/javax/net/ssl/SSLSession.html) | [getSession](../../../../reference/javax/net/ssl/SSLSessionContext.html#getSession(byte[]))(byte\\[\\] sessionId) Returns the `SSLSession` bound to the specified session id. |\n| abstract int | [getSessionCacheSize](../../../../reference/javax/net/ssl/SSLSessionContext.html#getSessionCacheSize())() Returns the size of the cache used for storing `SSLSession` objects grouped under this `SSLSessionContext`. |\n| abstract int | [getSessionTimeout](../../../../reference/javax/net/ssl/SSLSessionContext.html#getSessionTimeout())() Returns the timeout limit of `SSLSession` objects grouped under this `SSLSessionContext`. |\n| abstract void | [setSessionCacheSize](../../../../reference/javax/net/ssl/SSLSessionContext.html#setSessionCacheSize(int))(int size) Sets the size of the cache used for storing `SSLSession` objects grouped under this `SSLSessionContext`. |\n| abstract void | [setSessionTimeout](../../../../reference/javax/net/ssl/SSLSessionContext.html#setSessionTimeout(int))(int seconds) Sets the timeout limit for `SSLSession` objects grouped under this `SSLSessionContext`. |\n\nPublic Methods \n\npublic abstract [Enumeration](../../../../reference/java/util/Enumeration.html)\\\u003cbyte\\[\\]\\\u003e\n**getIds**\n() \nReturns an Enumeration of all session id's grouped under this\n`SSLSessionContext`. \n\nReturns\n\n- an enumeration of all the Session id's \n\npublic abstract [SSLSession](../../../../reference/javax/net/ssl/SSLSession.html)\n**getSession**\n(byte\\[\\] sessionId) \nReturns the `SSLSession` bound to the specified session id. \n\nParameters\n\n| sessionId | the Session identifier |\n|-----------|------------------------|\n\nReturns\n\n- the `SSLSession` or null if the specified session id does not refer to a valid SSLSession. \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `sessionId` is null. |\n|-----------------------------------------------------------------------------------|-------------------------|\n\npublic abstract int\n**getSessionCacheSize**\n() \nReturns the size of the cache used for storing\n`SSLSession` objects grouped under this\n`SSLSessionContext`. \n\nReturns\n\n- size of the session cache; zero means there is no size limit. \n\nSee Also\n\n- [setSessionCacheSize(int)](../../../../reference/javax/net/ssl/SSLSessionContext.html#setSessionCacheSize(int)) \n\npublic abstract int\n**getSessionTimeout**\n() \nReturns the timeout limit of `SSLSession` objects grouped\nunder this `SSLSessionContext`.\n\n\nIf the timeout limit is set to 't' seconds, a session exceeds the\ntimeout limit 't' seconds after its creation time.\nWhen the timeout limit is exceeded for a session, the\n`SSLSession` object is invalidated and future connections\ncannot resume or rejoin the session.\nA check for sessions exceeding the timeout limit is made immediately\nwhenever the timeout limit is changed for this\n`SSLSessionContext`. \n\nReturns\n\n- the session timeout limit in seconds; zero means there is no limit. \n\nSee Also\n\n- [setSessionTimeout(int)](../../../../reference/javax/net/ssl/SSLSessionContext.html#setSessionTimeout(int)) \n\npublic abstract void\n**setSessionCacheSize**\n(int size) \nSets the size of the cache used for storing\n`SSLSession` objects grouped under this\n`SSLSessionContext`. \n\nParameters\n\n| size | the new session cache size limit; zero means there is no limit. |\n|------|-----------------------------------------------------------------|\n\nThrows\n\n| [IllegalArgumentException](../../../../reference/java/lang/IllegalArgumentException.html) | if the specified size is `\u003c 0`. |\n|-------------------------------------------------------------------------------------------|---------------------------------|\n\nSee Also\n\n- [getSessionCacheSize()](../../../../reference/javax/net/ssl/SSLSessionContext.html#getSessionCacheSize()) \n\npublic abstract void\n**setSessionTimeout**\n(int seconds) \nSets the timeout limit for `SSLSession` objects grouped\nunder this `SSLSessionContext`.\n\n\nIf the timeout limit is set to 't' seconds, a session exceeds the\ntimeout limit 't' seconds after its creation time.\nWhen the timeout limit is exceeded for a session, the\n`SSLSession` object is invalidated and future connections\ncannot resume or rejoin the session.\nA check for sessions exceeding the timeout is made immediately whenever\nthe timeout limit is changed for this `SSLSessionContext`. \n\nParameters\n\n| seconds | the new session timeout limit in seconds; zero means there is no limit. |\n|---------|-------------------------------------------------------------------------|\n\nThrows\n\n| [IllegalArgumentException](../../../../reference/java/lang/IllegalArgumentException.html) | if the timeout specified is `\u003c 0`. |\n|-------------------------------------------------------------------------------------------|------------------------------------|\n\nSee Also\n\n- [getSessionTimeout()](../../../../reference/javax/net/ssl/SSLSessionContext.html#getSessionTimeout())"]]