HttpsConfigurator.java revision 3105
2362N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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. 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 0N/A * This class is used to configure the https parameters for each incoming 0N/A * https connection on a HttpsServer. Applications need to override 0N/A * the {@link #configure(HttpsParameters)} method in order to change 0N/A * the default configuration. 0N/A * The following <a name="example">example</a> shows how this may be done: 0N/A * SSLContext sslContext = SSLContext.getInstance (....); 0N/A * HttpsServer server = HttpsServer.create(); 0N/A * server.setHttpsConfigurator (new HttpsConfigurator(sslContext) { 0N/A * public void configure (HttpsParameters params) { 0N/A * // get the remote address if needed 0N/A * InetSocketAddress remote = params.getClientAddress(); 0N/A * SSLContext c = getSSLContext(); 0N/A * // get the default parameters 0N/A * SSLParameters sslparams = c.getDefaultSSLParameters(); 0N/A * if (remote.equals (...) ) { 0N/A * // modify the default set for client x 0N/A * params.setSSLParameters(sslparams); 0N/A * </blockquote></pre> 0N/A * Creates an Https configuration, with the given SSLContext. 0N/A * @param context the SSLContext to use for this configurator 0N/A * @throws NullPointerException if no SSLContext supplied 0N/A * Returns the SSLContext for this HttpsConfigurator. 0N/A * @return the SSLContext 0N/A * Called by the HttpsServer to configure the parameters 0N/A * for a https connection currently being established. 0N/A * The implementation of configure() must call 0N/A * {@link HttpsParameters#setSSLParameters(SSLParameters)} 0N/A * in order to set the SSL parameters for the connection. 0N/A * The default implementation of this method uses the 0N/A * SSLParameters returned from <p> 0N/A * <code>getSSLContext().getDefaultSSLParameters()</code> 0N/A * configure() may be overridden in order to modify this behavior. 0N/A * See, the example <a href="#example">above</a>. 0N/A * @param params the HttpsParameters to be configured.