java.lang.Object
cloud.piranha.http.impl.DefaultHttpServer
- All Implemented Interfaces:
HttpServer
public class DefaultHttpServer extends java.lang.Object implements HttpServer
The default implementation of HTTP Server.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ExecutorService
executorService
Stores the executor service.protected HttpServerProcessor
processor
Stores the processor.protected java.lang.Thread
serverAcceptorThread
Stores the server acceptor thread.protected int
serverPort
Stores the port we are listening on.protected java.net.ServerSocket
serverSocket
Stores the server socket.protected boolean
serverStopRequest
Stores the server stop request.protected int
soTimeout
Stores the SO_TIMEOUT.protected boolean
ssl
Stores the SSL flag.protected java.util.concurrent.ThreadFactory
threadFactory
Stores the thread factory. -
Constructor Summary
Constructors Constructor Description DefaultHttpServer()
ConstructorDefaultHttpServer(int serverPort)
Constructor.DefaultHttpServer(int serverPort, HttpServerProcessor processor, boolean ssl)
ConstructorDefaultHttpServer(int serverPort, HttpServerProcessor processor, int soTimeout)
Constructor -
Method Summary
Modifier and Type Method Description HttpServerProcessor
getHttpServerProcessor()
Get the http server processorint
getServerPort()
Get the server portint
getSoTimeout()
Get the SO_TIMEOUT.boolean
getSSL()
Get the SSL flagboolean
isRunning()
Check if the server is running.void
setHttpServerProcessor(HttpServerProcessor httpServerProcessor)
Set the http server processorvoid
setServerPort(int serverPort)
Set the server portvoid
setSSL(boolean ssl)
Set the SSL flagvoid
start()
Start the server.void
stop()
Stop the server.
-
Field Details
-
executorService
protected java.util.concurrent.ExecutorService executorServiceStores the executor service. -
processor
Stores the processor. -
serverPort
protected int serverPortStores the port we are listening on. -
serverAcceptorThread
protected java.lang.Thread serverAcceptorThreadStores the server acceptor thread. -
serverSocket
protected java.net.ServerSocket serverSocketStores the server socket. -
serverStopRequest
protected boolean serverStopRequestStores the server stop request. -
soTimeout
protected int soTimeoutStores the SO_TIMEOUT. -
ssl
protected boolean sslStores the SSL flag. -
threadFactory
protected java.util.concurrent.ThreadFactory threadFactoryStores the thread factory.
-
-
Constructor Details
-
DefaultHttpServer
public DefaultHttpServer()Constructor -
DefaultHttpServer
public DefaultHttpServer(int serverPort)Constructor.- Parameters:
serverPort
- the server port.
-
DefaultHttpServer
Constructor- Parameters:
serverPort
- the server port.processor
- the HTTP server processor.ssl
- the SSL flag.
-
DefaultHttpServer
Constructor- Parameters:
serverPort
- the server port.processor
- the HTTP server processor.soTimeout
- the SO_TIMEOUT.
-
-
Method Details
-
getSoTimeout
public int getSoTimeout()Get the SO_TIMEOUT.- Returns:
- the SO_TIMEOUT.
-
isRunning
public boolean isRunning()Description copied from interface:HttpServer
Check if the server is running.- Specified by:
isRunning
in interfaceHttpServer
- Returns:
- true if it is, false otherwise.
- See Also:
HttpServer.isRunning()
-
start
public void start()Description copied from interface:HttpServer
Start the server.- Specified by:
start
in interfaceHttpServer
- See Also:
HttpServer.start()
-
stop
public void stop()Description copied from interface:HttpServer
Stop the server.- Specified by:
stop
in interfaceHttpServer
- See Also:
HttpServer.stop()
-
getServerPort
public int getServerPort()Description copied from interface:HttpServer
Get the server port- Specified by:
getServerPort
in interfaceHttpServer
- Returns:
- the server port
-
setServerPort
public void setServerPort(int serverPort)Description copied from interface:HttpServer
Set the server port- Specified by:
setServerPort
in interfaceHttpServer
- Parameters:
serverPort
- the port
-
setSSL
public void setSSL(boolean ssl)Description copied from interface:HttpServer
Set the SSL flag- Specified by:
setSSL
in interfaceHttpServer
- Parameters:
ssl
- the SSL flag
-
getSSL
public boolean getSSL()Description copied from interface:HttpServer
Get the SSL flag- Specified by:
getSSL
in interfaceHttpServer
- Returns:
- the server port
-
setHttpServerProcessor
Description copied from interface:HttpServer
Set the http server processor- Specified by:
setHttpServerProcessor
in interfaceHttpServer
- Parameters:
httpServerProcessor
- the http server processor
-
getHttpServerProcessor
Description copied from interface:HttpServer
Get the http server processor- Specified by:
getHttpServerProcessor
in interfaceHttpServer
- Returns:
- the http server processor
-