0N/A/*
3261N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.net.httpserver;
2940N/Aimport java.net.InetSocketAddress;
3105N/A//BEGIN_TIGER_EXCLUDE
0N/Aimport javax.net.ssl.SSLParameters;
3105N/A//END_TIGER_EXCLUDE
0N/A
0N/A/**
0N/A * Represents the set of parameters for each https
0N/A * connection negotiated with clients. One of these
0N/A * is created and passed to
0N/A * {@link HttpsConfigurator#configure(HttpsParameters)}
0N/A * for every incoming https connection,
0N/A * in order to determine the parameters to use.
0N/A * <p>
0N/A * The underlying SSL parameters may be established either
0N/A * via the set/get methods of this class, or else via
0N/A * a {@link javax.net.ssl.SSLParameters} object. SSLParameters
0N/A * is the preferred method, because in the future,
0N/A * additional configuration capabilities may be added to that class, and
0N/A * it is easier to determine the set of supported parameters and their
0N/A * default values with SSLParameters. Also, if an SSLParameters object is
0N/A * provided via
0N/A * {@link #setSSLParameters(SSLParameters)} then those parameter settings
0N/A * are used, and any settings made in this object are ignored.
0N/A * @since 1.6
0N/A */
0N/Apublic abstract class HttpsParameters {
0N/A
0N/A private String[] cipherSuites;
0N/A private String[] protocols;
0N/A private boolean wantClientAuth;
0N/A private boolean needClientAuth;
0N/A
0N/A protected HttpsParameters() {}
0N/A
0N/A /**
0N/A * Returns the HttpsConfigurator for this HttpsParameters.
0N/A */
0N/A public abstract HttpsConfigurator getHttpsConfigurator();
0N/A
0N/A /**
0N/A * Returns the address of the remote client initiating the
0N/A * connection.
0N/A */
0N/A public abstract InetSocketAddress getClientAddress();
0N/A
3105N/A//BEGIN_TIGER_EXCLUDE
0N/A /**
0N/A * Sets the SSLParameters to use for this HttpsParameters.
0N/A * The parameters must be supported by the SSLContext contained
0N/A * by the HttpsConfigurator associated with this HttpsParameters.
0N/A * If no parameters are set, then the default behavior is to use
0N/A * the default parameters from the associated SSLContext.
0N/A * @param params the SSLParameters to set. If <code>null</code>
0N/A * then the existing parameters (if any) remain unchanged.
0N/A * @throws IllegalArgumentException if any of the parameters are
0N/A * invalid or unsupported.
0N/A */
0N/A public abstract void setSSLParameters (SSLParameters params);
3105N/A//END_TIGER_EXCLUDE
0N/A
0N/A /**
0N/A * Returns a copy of the array of ciphersuites or null if none
0N/A * have been set.
0N/A *
0N/A * @return a copy of the array of ciphersuites or null if none
0N/A * have been set.
0N/A */
0N/A public String[] getCipherSuites() {
2940N/A return cipherSuites != null ? cipherSuites.clone() : null;
0N/A }
0N/A
0N/A /**
0N/A * Sets the array of ciphersuites.
0N/A *
0N/A * @param cipherSuites the array of ciphersuites (or null)
0N/A */
0N/A public void setCipherSuites(String[] cipherSuites) {
2940N/A this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;
0N/A }
0N/A
0N/A /**
0N/A * Returns a copy of the array of protocols or null if none
0N/A * have been set.
0N/A *
0N/A * @return a copy of the array of protocols or null if none
0N/A * have been set.
0N/A */
0N/A public String[] getProtocols() {
2940N/A return protocols != null ? protocols.clone() : null;
0N/A }
0N/A
0N/A /**
0N/A * Sets the array of protocols.
0N/A *
0N/A * @param protocols the array of protocols (or null)
0N/A */
0N/A public void setProtocols(String[] protocols) {
2940N/A this.protocols = protocols != null ? protocols.clone() : null;
0N/A }
0N/A
0N/A /**
0N/A * Returns whether client authentication should be requested.
0N/A *
0N/A * @return whether client authentication should be requested.
0N/A */
0N/A public boolean getWantClientAuth() {
0N/A return wantClientAuth;
0N/A }
0N/A
0N/A /**
0N/A * Sets whether client authentication should be requested. Calling
0N/A * this method clears the <code>needClientAuth</code> flag.
0N/A *
0N/A * @param wantClientAuth whether client authentication should be requested
0N/A */
0N/A public void setWantClientAuth(boolean wantClientAuth) {
0N/A this.wantClientAuth = wantClientAuth;
0N/A }
0N/A
0N/A /**
0N/A * Returns whether client authentication should be required.
0N/A *
0N/A * @return whether client authentication should be required.
0N/A */
0N/A public boolean getNeedClientAuth() {
0N/A return needClientAuth;
0N/A }
0N/A
0N/A /**
0N/A * Sets whether client authentication should be required. Calling
0N/A * this method clears the <code>wantClientAuth</code> flag.
0N/A *
0N/A * @param needClientAuth whether client authentication should be required
0N/A */
0N/A public void setNeedClientAuth(boolean needClientAuth) {
0N/A this.needClientAuth = needClientAuth;
0N/A }
0N/A}