Class HttpsServer

java.lang.Object
com.sun.net.httpserver.HttpServer
com.sun.net.httpserver.HttpsServer

public abstract class HttpsServer extends HttpServer
This class is an extension of HttpServer which provides support for HTTPS.

A HttpsServer must have an associated HttpsConfigurator object which is used to establish the SSL configuration for the SSL connections.

All other configuration is the same as for HttpServer.

Since:
1.6
  • Constructor Details

    • HttpsServer

      protected HttpsServer()
      Constructor for subclasses to call.
  • Method Details

    • create

      public static HttpsServer create() throws IOException
      Creates a HttpsServer instance which is initially not bound to any local address/port. The HttpsServer is acquired from the currently installed HttpServerProvider. The server must be bound using HttpServer.bind(InetSocketAddress,int) before it can be used. The server must also have a HttpsConfigurator established with setHttpsConfigurator(HttpsConfigurator).
      Returns:
      an instance of HttpsServer
      Throws:
      IOException - if an I/O error occurs
    • create

      public static HttpsServer create(InetSocketAddress addr, int backlog) throws IOException
      Create a HttpsServer instance which will bind to the specified InetSocketAddress (IP address and port number). A maximum backlog can also be specified. This is the maximum number of queued incoming connections to allow on the listening socket. Queued TCP connections exceeding this limit may be rejected by the TCP implementation. The HttpsServer is acquired from the currently installed