Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/net/httpserver/HttpsParameters.java
38922 views
/*1* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.net.httpserver;26import java.net.InetSocketAddress;27//BEGIN_TIGER_EXCLUDE28import javax.net.ssl.SSLParameters;29//END_TIGER_EXCLUDE3031/**32* Represents the set of parameters for each https33* connection negotiated with clients. One of these34* is created and passed to35* {@link HttpsConfigurator#configure(HttpsParameters)}36* for every incoming https connection,37* in order to determine the parameters to use.38* <p>39* The underlying SSL parameters may be established either40* via the set/get methods of this class, or else via41* a {@link javax.net.ssl.SSLParameters} object. SSLParameters42* is the preferred method, because in the future,43* additional configuration capabilities may be added to that class, and44* it is easier to determine the set of supported parameters and their45* default values with SSLParameters. Also, if an SSLParameters object is46* provided via47* {@link #setSSLParameters(SSLParameters)} then those parameter settings48* are used, and any settings made in this object are ignored.49* @since 1.650*/51@jdk.Exported52public abstract class HttpsParameters {5354private String[] cipherSuites;55private String[] protocols;56private boolean wantClientAuth;57private boolean needClientAuth;5859protected HttpsParameters() {}6061/**62* Returns the HttpsConfigurator for this HttpsParameters.63*/64public abstract HttpsConfigurator getHttpsConfigurator();6566/**67* Returns the address of the remote client initiating the68* connection.69*/70public abstract InetSocketAddress getClientAddress();7172//BEGIN_TIGER_EXCLUDE73/**74* Sets the SSLParameters to use for this HttpsParameters.75* The parameters must be supported by the SSLContext contained76* by the HttpsConfigurator associated with this HttpsParameters.77* If no parameters are set, then the default behavior is to use78* the default parameters from the associated SSLContext.79* @param params the SSLParameters to set. If <code>null</code>80* then the existing parameters (if any) remain unchanged.81* @throws IllegalArgumentException if any of the parameters are82* invalid or unsupported.83*/84public abstract void setSSLParameters (SSLParameters params);85//END_TIGER_EXCLUDE8687/**88* Returns a copy of the array of ciphersuites or null if none89* have been set.90*91* @return a copy of the array of ciphersuites or null if none92* have been set.93*/94public String[] getCipherSuites() {95return cipherSuites != null ? cipherSuites.clone() : null;96}9798/**99* Sets the array of ciphersuites.100*101* @param cipherSuites the array of ciphersuites (or null)102*/103public void setCipherSuites(String[] cipherSuites) {104this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;105}106107/**108* Returns a copy of the array of protocols or null if none109* have been set.110*111* @return a copy of the array of protocols or null if none112* have been set.113*/114public String[] getProtocols() {115return protocols != null ? protocols.clone() : null;116}117118/**119* Sets the array of protocols.120*121* @param protocols the array of protocols (or null)122*/123public void setProtocols(String[] protocols) {124this.protocols = protocols != null ? protocols.clone() : null;125}126127/**128* Returns whether client authentication should be requested.129*130* @return whether client authentication should be requested.131*/132public boolean getWantClientAuth() {133return wantClientAuth;134}135136/**137* Sets whether client authentication should be requested. Calling138* this method clears the <code>needClientAuth</code> flag.139*140* @param wantClientAuth whether client authentication should be requested141*/142public void setWantClientAuth(boolean wantClientAuth) {143this.wantClientAuth = wantClientAuth;144}145146/**147* Returns whether client authentication should be required.148*149* @return whether client authentication should be required.150*/151public boolean getNeedClientAuth() {152return needClientAuth;153}154155/**156* Sets whether client authentication should be required. Calling157* this method clears the <code>wantClientAuth</code> flag.158*159* @param needClientAuth whether client authentication should be required160*/161public void setNeedClientAuth(boolean needClientAuth) {162this.needClientAuth = needClientAuth;163}164}165166167