author | ascarpino |
Wed, 17 Jul 2019 14:37:50 -0700 | |
changeset 57485 | af4b0fc25bc4 |
parent 52764 | 8a85d21d9616 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
57485 | 2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
||
27 |
package javax.net.ssl; |
|
28 |
||
29 |
import java.util.Enumeration; |
|
30 |
||
31 |
||
32 |
/** |
|
33 |
* A <code>SSLSessionContext</code> represents a set of |
|
34 |
* <code>SSLSession</code>s associated with a single entity. For example, |
|
35 |
* it could be associated with a server or client who participates in many |
|
36 |
* sessions concurrently. |
|
37 |
* <p> |
|
57485 | 38 |
* Not all environments will contain session contexts. For example, stateless |
39 |
* session resumption. |
|
40 |
* <p> |
|
41 |
* Session contexts may not contain all sessions. For example, stateless |
|
42 |
* sessions are not stored in the session context. |
|
2 | 43 |
* <p> |
44 |
* There are <code>SSLSessionContext</code> parameters that affect how |
|
45 |
* sessions are stored: |
|
46 |
* <UL> |
|
47 |
* <LI>Sessions can be set to expire after a specified |
|
48 |
* time limit. |
|
49 |
* <LI>The number of sessions that can be stored in context |
|
50 |
* can be limited. |
|
51 |
* </UL> |
|
52 |
* A session can be retrieved based on its session id, and all session id's |
|
53 |
* in a <code>SSLSessionContext</code> can be listed. |
|
54 |
* |
|
55 |
* @see SSLSession |
|
56 |
* |
|
57 |
* @since 1.4 |
|
58 |
* @author Nathan Abramson |
|
59 |
* @author David Brownell |
|
60 |
*/ |
|
61 |
public interface SSLSessionContext { |
|
62 |
||
63 |
/** |
|
64 |
* Returns the <code>SSLSession</code> bound to the specified session id. |
|
65 |
* |
|
66 |
* @param sessionId the Session identifier |
|
67 |
* @return the <code>SSLSession</code> or null if |
|
68 |
* the specified session id does not refer to a valid SSLSession. |
|
69 |
* |
|
70 |
* @throws NullPointerException if <code>sessionId</code> is null. |
|
71 |
*/ |
|
72 |
public SSLSession getSession(byte[] sessionId); |
|
73 |
||
74 |
/** |
|
57485 | 75 |
* Returns an Enumeration of all known session id's grouped under this |
2 | 76 |
* <code>SSLSessionContext</code>. |
57485 | 77 |
* <p>Session contexts may not contain all sessions. For example, |
78 |
* stateless sessions are not stored in the session context. |
|
79 |
* <p> |
|
2 | 80 |
* |
81 |
* @return an enumeration of all the Session id's |
|
82 |
*/ |
|
83 |
public Enumeration<byte[]> getIds(); |
|
84 |
||
85 |
/** |
|
86 |
* Sets the timeout limit for <code>SSLSession</code> objects grouped |
|
87 |
* under this <code>SSLSessionContext</code>. |
|
88 |
* <p> |
|
89 |
* If the timeout limit is set to 't' seconds, a session exceeds the |
|
90 |
* timeout limit 't' seconds after its creation time. |
|
91 |
* When the timeout limit is exceeded for a session, the |
|
92 |
* <code>SSLSession</code> object is invalidated and future connections |
|
93 |
* cannot resume or rejoin the session. |
|
94 |
* A check for sessions exceeding the timeout is made immediately whenever |
|
95 |
* the timeout limit is changed for this <code>SSLSessionContext</code>. |
|
96 |
* |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
97 |
* @apiNote Note that the JDK Implementation uses default values for both |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
98 |
* the session cache size and timeout. See |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
99 |
* {@code getSessionCacheSize} and {@code getSessionTimeout} for |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
100 |
* more information. Applications should consider their |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
101 |
* performance requirements and override the defaults if necessary. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
102 |
* |
2 | 103 |
* @param seconds the new session timeout limit in seconds; zero means |
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
104 |
* there is no limit. |
2 | 105 |
* |
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
106 |
* @throws IllegalArgumentException if the timeout specified is {@code < 0}. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
107 |
* |
2 | 108 |
* @see #getSessionTimeout |
109 |
*/ |
|
110 |
public void setSessionTimeout(int seconds) |
|
111 |
throws IllegalArgumentException; |
|
112 |
||
113 |
/** |
|
114 |
* Returns the timeout limit of <code>SSLSession</code> objects grouped |
|
115 |
* under this <code>SSLSessionContext</code>. |
|
116 |
* <p> |
|
117 |
* If the timeout limit is set to 't' seconds, a session exceeds the |
|
118 |
* timeout limit 't' seconds after its creation time. |
|
119 |
* When the timeout limit is exceeded for a session, the |
|
120 |
* <code>SSLSession</code> object is invalidated and future connections |
|
121 |
* cannot resume or rejoin the session. |
|
122 |
* A check for sessions exceeding the timeout limit is made immediately |
|
123 |
* whenever the timeout limit is changed for this |
|
124 |
* <code>SSLSessionContext</code>. |
|
125 |
* |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
126 |
* @implNote The JDK implementation returns the session timeout as set by |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
127 |
* the {@code setSessionTimeout} method, or if not set, a default |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
128 |
* value of 86400 seconds (24 hours). |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
129 |
* |
2 | 130 |
* @return the session timeout limit in seconds; zero means there is no |
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
131 |
* limit. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
132 |
* |
2 | 133 |
* @see #setSessionTimeout |
134 |
*/ |
|
135 |
public int getSessionTimeout(); |
|
136 |
||
137 |
/** |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
138 |
* Sets the size of the cache used for storing <code>SSLSession</code> |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
139 |
* objects grouped under this <code>SSLSessionContext</code>. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
140 |
* |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
141 |
* @apiNote Note that the JDK Implementation uses default values for both |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
142 |
* the session cache size and timeout. See |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
143 |
* {@code getSessionCacheSize} and {@code getSessionTimeout} for |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
144 |
* more information. Applications should consider their |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
145 |
* performance requirements and override the defaults if necessary. |
2 | 146 |
* |
147 |
* @param size the new session cache size limit; zero means there is no |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
148 |
* limit. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
149 |
* |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
150 |
* @throws IllegalArgumentException if the specified size is {@code < 0}. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
151 |
* |
2 | 152 |
* @see #getSessionCacheSize |
153 |
*/ |
|
154 |
public void setSessionCacheSize(int size) |
|
155 |
throws IllegalArgumentException; |
|
156 |
||
157 |
/** |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
158 |
* Returns the size of the cache used for storing <code>SSLSession</code> |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
159 |
* objects grouped under this <code>SSLSessionContext</code>. |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
160 |
* |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
161 |
* @implNote The JDK implementation returns the cache size as set by |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
162 |
* the {@code setSessionCacheSize} method, or if not set, the |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
163 |
* value of the {@systemProperty javax.net.ssl.sessionCacheSize} |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
164 |
* system property. If neither is set, it returns a default |
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
165 |
* value of 20480. |
2 | 166 |
* |
167 |
* @return size of the session cache; zero means there is no size limit. |
|
52764
8a85d21d9616
8210985: Update the default SSL session cache size to 20480
xuelei
parents:
47216
diff
changeset
|
168 |
* |
2 | 169 |
* @see #setSessionCacheSize |
170 |
*/ |
|
171 |
public int getSessionCacheSize(); |
|
172 |
} |