- java.lang.Object
-
- com.kttdevelopment.simplehttpserver.SimpleHttpServer
-
- com.kttdevelopment.simplehttpserver.SimpleHttpsServer
-
public abstract class SimpleHttpsServer extends SimpleHttpServer
This class is a simplified implementation ofHttpsServer. The server must have aHttpsConfiguratorset usingsetHttpsConfigurator(HttpsConfigurator).
At least oneHttpHandlermust be created in order to process requests. When handling requests the server will use the most specific context. If no handler can be found it is rejected with a 404 response.
Contexts are case-sensitive.- Since:
- 02.00.00
- Version:
- 03.04.01
- Author:
- Ktt Development
- See Also:
HttpsServer,HttpHandler,SimpleHttpServer,SimpleHttpHandler
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleHttpsServer()Creates an emptySimpleHttpsServer.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static SimpleHttpsServercreate()Creates aSimpleHttpsServer.static SimpleHttpsServercreate(int port)Creates aSimpleHttpsServerbounded to a port.static SimpleHttpsServercreate(int port, int backlog)Creates aSimpleHttpsServerbounded to a port.abstract HttpsConfiguratorgetHttpsConfigurator()Returns the https configurator of the serverabstract HttpsServergetHttpServer()Returns the native https server.abstract voidsetHttpsConfigurator(HttpsConfigurator config)Sets a https configurator for the server-
Methods inherited from class com.kttdevelopment.simplehttpserver.SimpleHttpServer
bind, bind, bind, bind, createContext, createContext, createContext, createContext, getAddress, getContextHandler, getContextHandler, getContexts, getExecutor, getHttpSession, getHttpSession, getHttpSessionHandler, getRandomContext, getRandomContext, removeContext, removeContext, setExecutor, setHttpSessionHandler, start, stop, stop
-
-
-
-
Constructor Detail
-
SimpleHttpsServer
protected SimpleHttpsServer()
Creates an emptySimpleHttpsServer. Server is created usingcreate(),create(int), orcreate(int, int).- Since:
- 02.00.00
- See Also:
create(),create(int),create(int, int),SimpleHttpsServerImpl.createSimpleHttpsServer(Integer, Integer)
-
-
Method Detail
-
create
public static SimpleHttpsServer create() throws IOException
Creates aSimpleHttpsServer. The server must have aHttpsConfiguratorset usingsetHttpsConfigurator(HttpsConfigurator).- Returns:
- a
SimpleHttpsServer - Throws:
IOException- uncaught exception- Since:
- 03.04.00
-
create
public static SimpleHttpsServer create(int port) throws IOException
Creates aSimpleHttpsServerbounded to a port. The server must have aHttpsConfiguratorset usingsetHttpsConfigurator(HttpsConfigurator).- Parameters:
port- port to bind to- Returns:
- a
SimpleHttpsServer - Throws:
BindException- if server can not bind to portNullPointerException- if address isnullIllegalArgumentException- if port is out of rangeIOException- uncaught exception- Since:
- 03.04.00
-
create
public static SimpleHttpsServer create(int port, int backlog) throws IOException
Creates aSimpleHttpsServerbounded to a port. The server must have aHttpsConfiguratorset usingsetHttpsConfigurator(HttpsConfigurator).- Parameters:
port- port to bind tobacklog- maximum amount of inbound connections allowed- Returns:
- a
SimpleHttpsServer - Throws:
BindException- if server can not bind to portNullPointerException- if address isnullIllegalArgumentException- if port is out of rangeIOException- uncaught exception- Since:
- 03.04.00
-
getHttpServer
public abstract HttpsServer getHttpServer()
Returns the native https server.- Specified by:
getHttpServerin classSimpleHttpServer- Returns:
- https server
- Since:
- 03.04.00
- See Also:
HttpsServer
-
setHttpsConfigurator
public abstract void setHttpsConfigurator(HttpsConfigurator config)
Sets a https configurator for the server- Parameters:
config- the https configurator- Throws:
NullPointerException- if config is null- Since:
- 03.04.00
-
getHttpsConfigurator
public abstract HttpsConfigurator getHttpsConfigurator()
Returns the https configurator of the server- Returns:
- the https configurator
- Since:
- 03.04.00
-
-