public class HTTPServer
extends org.threadly.util.AbstractService
Modifier and Type | Class | Description |
---|---|---|
static class |
HTTPServer.BodyFuture |
A simple callback class to allow HTTPServerHandlers to listen for body data as it
comes in from the clients socket.
|
static interface |
HTTPServer.BodyListener |
A simple callback interface used to receive body data from an HTTP client.
|
static interface |
HTTPServer.HTTPServerHandler |
The servers handler interface.
|
static class |
HTTPServer.ResponseWriter |
This class is used to write responses to HTTPRequests that are made against the HTTPServer.
|
Modifier and Type | Field | Description |
---|---|---|
static org.threadly.litesockets.protocols.http.response.HTTPResponse |
NOT_FOUND_RESPONSE |
Constructor | Description |
---|---|
HTTPServer(org.threadly.litesockets.SocketExecuter se,
java.lang.String hostName,
int port) |
Constructs an
HTTPServer without SSL support. |
HTTPServer(org.threadly.litesockets.SocketExecuter se,
java.lang.String hostName,
int port,
javax.net.ssl.SSLContext sslc) |
Constructs an
HTTPServer with SSL support. |
Modifier and Type | Method | Description |
---|---|---|
void |
addHandler(HTTPServer.HTTPServerHandler handler) |
Sets an
HTTPServer.HTTPServerHandler to this server. |
java.lang.String |
getHostName() |
|
int |
getListenPort() |
|
void |
setSSLContext(javax.net.ssl.SSLContext sslc) |
Allows you to set/reset the ssl context on the server.
|
public static final org.threadly.litesockets.protocols.http.response.HTTPResponse NOT_FOUND_RESPONSE
public HTTPServer(org.threadly.litesockets.SocketExecuter se, java.lang.String hostName, int port) throws java.io.IOException
HTTPServer
without SSL support.se
- The SocketExecuter
to use for this HTTPServer.hostName
- The hostname or ip to bind this httpServer too.port
- the port this server will bind to.java.io.IOException
- this is thrown if we have problems creating this HTTPServers listen socket.public HTTPServer(org.threadly.litesockets.SocketExecuter se, java.lang.String hostName, int port, javax.net.ssl.SSLContext sslc) throws java.io.IOException
HTTPServer
with SSL support.se
- The SocketExecuter
to use for this HTTPServer.hostName
- The hostname or ip to bind this httpServer too.port
- the port this server will bind to.sslc
- the SSLContext
to use for this server.java.io.IOException
- this is thrown if we have problems creating this HTTPServers listen socket.public int getListenPort()
public void setSSLContext(javax.net.ssl.SSLContext sslc)
sslc
- The sslContext to use.public java.lang.String getHostName()
public void addHandler(HTTPServer.HTTPServerHandler handler)
HTTPServer.HTTPServerHandler
to this server.handler
- the handler to use.