APIdia Launch Partner
Top Description Methods
javax.net.ssl

public Interface SSLSessionContext

Known Direct Implementers
sun.security.ssl.SSLSessionContextImpl
Imports
java.util.Enumeration

A SSLSessionContext represents a set of SSLSessions 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. For example, stateless session resumption.

Session contexts may not contain all sessions. For example, stateless sessions are not stored in the session context.

There are SSLSessionContext parameters that affect how sessions are stored:

A session can be retrieved based on its session id, and all session id's in a SSLSessionContext can be listed.
Authors
Nathan Abramson, David Brownell
Since
1.4
See Also
SSLSession

Method Summary

Modifier and TypeMethod and Description
public Enumeration<byte[]>

Returns:

an enumeration of all the Session id's
getIds
()

Returns an Enumeration of all known session id's grouped under this SSLSessionContext.

public SSLSession

Returns:

the SSLSession or null if the specified session id does not refer to a valid SSLSession.
getSession
(byte[]
the Session identifier
sessionId
)

Returns the SSLSession bound to the specified session id.

public int

Returns:

size of the session cache; zero means there is no size limit.
getSessionCacheSize
()

Returns the size of the cache used for storing SSLSession objects grouped under this SSLSessionContext.

public int

Returns:

the session timeout limit in seconds; zero means there is no limit.
getSessionTimeout
()

Returns the timeout limit of SSLSession objects grouped under this SSLSessionContext.

public void
setSessionCacheSize(int
the new session cache size limit; zero means there is no limit.
size
)

Sets the size of the cache used for storing SSLSession objects grouped under this SSLSessionContext.

public void
setSessionTimeout(int
the new session timeout limit in seconds; zero means there is no limit.
seconds
)

Sets the timeout limit for SSLSession objects grouped under this SSLSessionContext.

Method Detail

getIdsback to summary
public Enumeration<byte[]> getIds()

Returns an Enumeration of all known session id's grouped under this SSLSessionContext.

Session contexts may not contain all sessions. For example, stateless sessions are not stored in the session context.

Returns:Enumeration<byte[]>

an enumeration of all the Session id's

getSessionback to summary
public SSLSession getSession(byte[] sessionId)

Returns the SSLSession bound to the specified session id.

Parameters
sessionId:byte[]

the Session identifier

Returns:SSLSession

the SSLSession or null if the specified session id does not refer to a valid SSLSession.

Exceptions
NullPointerException:
if sessionId is null.
getSessionCacheSizeback to summary
public int getSessionCacheSize()

Returns the size of the cache used for storing SSLSession objects grouped under this SSLSessionContext.

Implementation Note

The JDK implementation returns the cache size as set by the setSessionCacheSize method, or if not set, the value of the javax.net.ssl.sessionCacheSize system property. If neither is set, it returns a default value of 20480.

Returns:int

size of the session cache; zero means there is no size limit.

See Also
setSessionCacheSize
getSessionTimeoutback to summary
public 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 marked so that future connections cannot resume or rejoin the session. Active sessions can continue to be used so long as resume and rejoin operations are not attempted. A check for sessions exceeding the timeout limit is made immediately whenever the timeout limit is changed for this SSLSessionContext.

Implementation Note

The JDK implementation returns the session timeout as set by the setSessionTimeout method, or if not set, a default value of 86400 seconds (24 hours).

Returns:int

the session timeout limit in seconds; zero means there is no limit.

See Also
setSessionTimeout
setSessionCacheSizeback to summary
public void setSessionCacheSize(int size)

Sets the size of the cache used for storing SSLSession objects grouped under this SSLSessionContext.

API Note

Note that the JDK Implementation uses default values for both the session cache size and timeout. See getSessionCacheSize and getSessionTimeout for more information. Applications should consider their performance requirements and override the defaults if necessary.

Parameters
size:int

the new session cache size limit; zero means there is no limit.

Exceptions
IllegalArgumentException:
if the specified size is < 0.
See Also
getSessionCacheSize
setSessionTimeoutback to summary
public 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 marked so that future connections cannot resume or rejoin the session. Active sessions can continue to be used so long as resume and rejoin operations are not attempted. A check for sessions exceeding the timeout is made immediately whenever the timeout limit is changed for this SSLSessionContext.

API Note

Note that the JDK Implementation uses default values for both the session cache size and timeout. See getSessionCacheSize and getSessionTimeout for more information. Applications should consider their performance requirements and override the defaults if necessary.

Parameters
seconds:int

the new session timeout limit in seconds; zero means there is no limit.

Exceptions
IllegalArgumentException:
if the timeout specified is < 0.
See Also
getSessionTimeout