java.lang.Object
cloud.piranha.http.impl.DefaultHttpServer
- All Implemented Interfaces:
HttpServer
The default implementation of a HTTP Server.
When you create the DefaultHttpServer with a port number of -2, it will
automatically assign a random port in the range of 1025-9999 when you call
start(). You can determine which port was assigned by calling
getServerPort().
- Author:
- Manfred Riem (mriem@manorrock.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExecutorServiceStores the executor service.protected HttpServerProcessorStores the processor.protected ThreadStores the server acceptor thread.protected intStores the port we are listening on.protected ServerSocketStores the server socket.protected booleanStores the server stop request.protected intStores the SO_TIMEOUT.protected booleanStores the SSL flag.protected ThreadFactoryStores the thread factory. -
Constructor Summary
ConstructorsConstructorDescriptionConstructorDefaultHttpServer(int serverPort) Constructor.DefaultHttpServer(int serverPort, HttpServerProcessor processor, boolean ssl) ConstructorDefaultHttpServer(int serverPort, HttpServerProcessor processor, int soTimeout) Constructor -
Method Summary
Modifier and TypeMethodDescriptionintintReturns the SO_TIMEOUT.booleangetSSL()booleanvoidsetHttpServerProcessor(HttpServerProcessor httpServerProcessor) voidsetServerPort(int serverPort) voidsetSSL(boolean ssl) voidstart()voidstop()
-
Field Details
-
executorService
Stores the executor service. -
processor
Stores the processor. -
serverPort
protected int serverPortStores the port we are listening on. -
serverAcceptorThread
Stores the server acceptor thread. -
serverSocket
Stores 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
Stores 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
-
getHttpServerProcessor
- Specified by:
getHttpServerProcessorin interfaceHttpServer
-
getServerPort
public int getServerPort()- Specified by:
getServerPortin interfaceHttpServer
-
getSoTimeout
public int getSoTimeout()Returns the SO_TIMEOUT.- Returns:
- the SO_TIMEOUT
-
getSSL
public boolean getSSL()- Specified by:
getSSLin interfaceHttpServer
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceHttpServer
-
setHttpServerProcessor
- Specified by:
setHttpServerProcessorin interfaceHttpServer
-
setServerPort
public void setServerPort(int serverPort) - Specified by:
setServerPortin interfaceHttpServer
-
setSSL
public void setSSL(boolean ssl) - Specified by:
setSSLin interfaceHttpServer
-
start
public void start()- Specified by:
startin interfaceHttpServer
-
stop
public void stop()- Specified by:
stopin interfaceHttpServer
-