java.lang.Object
com.sun.net.httpserver.HttpServer
com.sun.net.httpserver.HttpsServer
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpsServercreate()Creates aHttpsServerinstance which is initially not bound to any local address/port.static HttpsServercreate(InetSocketAddress addr, int backlog) Create aHttpsServerinstance which will bind to the specifiedInetSocketAddress(IP address and port number).abstract HttpsConfiguratorGets this server'sHttpsConfiguratorobject, if it has been set.abstract voidSets this server'sHttpsConfiguratorobject.Methods declared in class com.sun.net.httpserver.HttpServer
bind, createContext, createContext, getAddress, getExecutor, removeContext, removeContext, setExecutor, start, stop
-
Constructor Details
-
HttpsServer
protected HttpsServer()Constructor for subclasses to call.
-
-
Method Details
-
create
Creates aHttpsServerinstance which is initially not bound to any local address/port. TheHttpsServeris acquired from the currently installedHttpServerProvider. The server must be bound usingHttpServer.bind(InetSocketAddress,int)before it can be used. The server must also have aHttpsConfiguratorestablished withsetHttpsConfigurator(HttpsConfigurator).- Returns:
- an instance of
HttpsServer - Throws:
IOException- if an I/O error occurs
-
create
Create aHttpsServerinstance which will bind to the specifiedInetSocketAddress(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. TheHttpsServeris acquired from the currently installedHttpServerProvider. The server must have aHttpsConfiguratorestablished withsetHttpsConfigurator(HttpsConfigurator).- Parameters:
addr- the address to listen on, ifnullthenHttpServer.bind(InetSocketAddress,int)must be called to set the addressbacklog- the socket backlog. If this value is less than or equal to zero, then a system default value is used.- Returns:
- an instance of
HttpsServer - Throws:
BindException- if the server cannot bind to the requested address, or if the server is already boundIOException- if an I/O error occurs
-
setHttpsConfigurator
Sets this server'sHttpsConfiguratorobject.- Parameters:
config- theHttpsConfiguratorto set- Throws:
NullPointerException- if config isnull
-
getHttpsConfigurator
Gets this server'sHttpsConfiguratorobject, if it has been set.- Returns:
- the
HttpsConfiguratorfor this server, ornullif not set
-