src/java.base/share/classes/javax/net/ssl/SSLSessionContext.java
author igerasim
Tue, 02 Oct 2018 10:19:07 -0700
changeset 51986 c1db377f6300
parent 47216 71c04702a3d5
child 52764 8a85d21d9616
permissions -rw-r--r--
8200381: Typos in javadoc - missing verb "be" and alike Reviewed-by: lancea, darcy, wetmore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 18156
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package javax.net.ssl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * A <code>SSLSessionContext</code> represents a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <code>SSLSession</code>s associated with a single entity. For example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * it could be associated with a server or client who participates in many
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * sessions concurrently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Not all environments will contain session contexts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * There are <code>SSLSessionContext</code> parameters that affect how
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * sessions are stored:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *      <LI>Sessions can be set to expire after a specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *      time limit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *      <LI>The number of sessions that can be stored in context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *      can be limited.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * A session can be retrieved based on its session id, and all session id's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * in a <code>SSLSessionContext</code> can be listed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @see SSLSession
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @author Nathan Abramson
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @author David Brownell
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
public interface SSLSessionContext {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Returns the <code>SSLSession</code> bound to the specified session id.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @param sessionId the Session identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @return the <code>SSLSession</code> or null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * the specified session id does not refer to a valid SSLSession.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * @throws NullPointerException if <code>sessionId</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public SSLSession getSession(byte[] sessionId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Returns an Enumeration of all session id's grouped under this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @return an enumeration of all the Session id's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public Enumeration<byte[]> getIds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * Sets the timeout limit for <code>SSLSession</code> objects grouped
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * under this <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * If the timeout limit is set to 't' seconds, a session exceeds the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * timeout limit 't' seconds after its creation time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * When the timeout limit is exceeded for a session, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * <code>SSLSession</code> object is invalidated and future connections
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * cannot resume or rejoin the session.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * A check for sessions exceeding the timeout is made immediately whenever
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * the timeout limit is changed for this <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @param seconds the new session timeout limit in seconds; zero means
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *          there is no limit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
    93
     * @exception IllegalArgumentException if the timeout specified is {@code < 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @see #getSessionTimeout
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public void setSessionTimeout(int seconds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                 throws IllegalArgumentException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * Returns the timeout limit of <code>SSLSession</code> objects grouped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * under this <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * If the timeout limit is set to 't' seconds, a session exceeds the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * timeout limit 't' seconds after its creation time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * When the timeout limit is exceeded for a session, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * <code>SSLSession</code> object is invalidated and future connections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * cannot resume or rejoin the session.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * A check for sessions exceeding the timeout limit is made immediately
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * whenever the timeout limit is changed for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @return the session timeout limit in seconds; zero means there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * limit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @see #setSessionTimeout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public int getSessionTimeout();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Sets the size of the cache used for storing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * <code>SSLSession</code> objects grouped under this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param size the new session cache size limit; zero means there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * limit.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
   125
     * @exception IllegalArgumentException if the specified size is {@code < 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @see #getSessionCacheSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public void setSessionCacheSize(int size)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                 throws IllegalArgumentException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Returns the size of the cache used for storing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * <code>SSLSession</code> objects grouped under this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * <code>SSLSessionContext</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @return size of the session cache; zero means there is no size limit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @see #setSessionCacheSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public int getSessionCacheSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
}