0N/A/*
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 *
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;
0N/A
0N/Aimport java.net.*;
0N/Aimport java.io.*;
0N/Aimport java.nio.*;
0N/Aimport java.security.*;
0N/Aimport java.nio.channels.*;
0N/Aimport java.util.*;
0N/Aimport java.util.concurrent.*;
0N/Aimport javax.net.ssl.*;
0N/Aimport com.sun.net.httpserver.spi.*;
0N/A
0N/A/**
0N/A * This class is an extension of {@link HttpServer} which provides
0N/A * support for HTTPS. <p>
0N/A * A HttpsServer must have an associated {@link HttpsConfigurator} object
0N/A * which is used to establish the SSL configuration for the SSL connections.
0N/A * <p>
0N/A * All other configuration is the same as for HttpServer.
0N/A * @since 1.6
0N/A */
0N/A
0N/Apublic abstract class HttpsServer extends HttpServer {
0N/A
0N/A /**
0N/A */
0N/A protected HttpsServer () {
0N/A }
0N/A
0N/A /**
0N/A * creates a HttpsServer instance which is initially not bound to any local address/port.
0N/A * The HttpsServer is acquired from the currently installed {@link HttpServerProvider}
0N/A * The server must be bound using {@link #bind(InetSocketAddress,int)} before it can be used.
0N/A * The server must also have a HttpsConfigurator established with {@link #setHttpsConfigurator(HttpsConfigurator)}
0N/A * @throws IOException
0N/A */
0N/A public static HttpsServer create () throws IOException {
0N/A return create (null, 0);
0N/A }
0N/A
0N/A /**
0N/A * Create a <code>HttpsServer</code> instance which will bind to the
0N/A * specified {@link java.net.InetSocketAddress} (IP address and port number)
0N/A *
0N/A * A maximum backlog can also be specified. This is the maximum number of
0N/A * queued incoming connections to allow on the listening socket.
0N/A * Queued TCP connections exceeding this limit may be rejected by the TCP implementation.
0N/A * The HttpsServer is acquired from the currently installed {@link HttpServerProvider}
0N/A * The server must have a HttpsConfigurator established with {@link #setHttpsConfigurator(HttpsConfigurator)}
0N/A *
0N/A * @param addr the address to listen on, if <code>null</code> then bind() must be called
0N/A * to set the address
0N/A * @param backlog the socket backlog. If this value is less than or equal to zero,
0N/A * then a system default value is used.
0N/A * @throws BindException if the server cannot bind to the requested address,
0N/A * or if the server is already bound.
0N/A * @throws IOException
0N/A */
0N/A
0N/A public static HttpsServer create (
0N/A InetSocketAddress addr, int backlog
0N/A ) throws IOException {
0N/A HttpServerProvider provider = HttpServerProvider.provider();
0N/A return provider.createHttpsServer (addr, backlog);
0N/A }
0N/A
0N/A /**
0N/A * Sets this server's {@link HttpsConfigurator} object.
0N/A * @param config the HttpsConfigurator to set
0N/A * @throws NullPointerException if config is null.
0N/A */
0N/A public abstract void setHttpsConfigurator (HttpsConfigurator config) ;
0N/A
0N/A /**
0N/A * Gets this server's {@link HttpsConfigurator} object, if it has been set.
0N/A * @return the HttpsConfigurator for this server, or <code>null</code> if not set.
0N/A */
0N/A public abstract HttpsConfigurator getHttpsConfigurator ();
0N/A}