Package org.kawanfw.sql.api.server.web
Class WebServerApi
java.lang.Object
org.kawanfw.sql.api.server.web.WebServerApi
public class WebServerApi extends Object
APIs to start and stop the embedded Web Server from a Java program.
Note that the
Note that the
org.kawanfw.sql.WebServer class is used to start and
stop the embedded Web Server from command line and uses the APIs of this
class. Source code is available here: WebServer.java.- Author:
- Nicolas de Pomereu
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PORTThe default port to use if parameter is not passed -
Constructor Summary
Constructors Constructor Description WebServerApi() -
Method Summary
Modifier and Type Method Description booleanisServerRunning()Says if the the embedded Web Server is running on on the default portDEFAULT_PORT.booleanisServerRunning(int port)Says if the the embedded Web Server is running on the specified port.voidstartServer(String host, int port, File propertiesFile)Starts the embedded Web Server.voidstartServer(String host, File propertiesFile)Starts the embedded Web Server on the default portDEFAULT_PORT.voidstopServer()Stops the embedded Web server running on the default portDEFAULT_PORT.voidstopServer(int port)Stops the embedded Web server running on the designated port.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORTThe default port to use if parameter is not passed- See Also:
- Constant Field Values
-
-
Constructor Details
-
WebServerApi
public WebServerApi()
-
-
Method Details
-
startServer
public void startServer(String host, int port, File propertiesFile) throws ConnectException, IOException, SQLException, DatabaseConfigurationException, org.apache.catalina.LifecycleExceptionStarts the embedded Web Server.- Parameters:
host- the host of the Web Serverport- the port of the Web ServerpropertiesFile- properties file to use for configuration of the Web Server- Throws:
ConnectException- if the default port is not availableIOException- if an IOException occursDatabaseConfigurationException- if there is a configuration error, either in Configurators or in theserver-sql.propertiesfileorg.apache.catalina.LifecycleException- thrown by embedded Tomcat for any lifecycle related problemSQLException- thrown by embedded Tomcat for any SQL Error
-
startServer
public void startServer(String host, File propertiesFile) throws ConnectException, IOException, DatabaseConfigurationException, org.apache.catalina.LifecycleException, SQLExceptionStarts the embedded Web Server on the default portDEFAULT_PORT.- Parameters:
host- the host of the Web ServerpropertiesFile- properties file to use for configuration of the Web Server- Throws:
ConnectException- if the default port is not availableIOException- if an IOException occursDatabaseConfigurationException- if there is a configuration error, either in Configurators or in theserver-sql.propertiesfileorg.apache.catalina.LifecycleException- thrown by embedded Tomcat for any lifecycle related problemSQLException- thrown by embedded Tomcat for any SQL Error
-
stopServer
Stops the embedded Web server running on the default portDEFAULT_PORT.- Throws:
IOException- if the semaphore file (that signals to the SQL Web Server to stop) can not be created
-
stopServer
Stops the embedded Web server running on the designated port.- Parameters:
port- the port on which the SQL Web server is running- Throws:
IOException- if the semaphore file (that signals to the Web Server to stop) can not be created
-
isServerRunning
public boolean isServerRunning()Says if the the embedded Web Server is running on on the default portDEFAULT_PORT.- Returns:
- true if the Web Server is running on the default port
-
isServerRunning
public boolean isServerRunning(int port)Says if the the embedded Web Server is running on the specified port.- Parameters:
port- the port of the Web Server- Returns:
- true if the Web Server is running on the specified port
-