WebServer

The web server is a simple standalone HTTP server that implements the H2 Console application. It is not optimized for performance.

Methods
String addSession(Connection conn)
Create a session with a given connection.
String addSession(Connection conn) throws SQLException
Create a session with a given connection.
Parameters:
conn - the connection
Returns:
the URL of the web site to access this connection
WebSession createNewSession(String hostAddr)
Create a new web session id and object.
WebSession createNewSession(String hostAddr)
Create a new web session id and object.
Parameters:
hostAddr - the host address
Returns:
the web session object
boolean getAllowChunked()
boolean getAllowChunked()
boolean getAllowOthers()
boolean getAllowOthers()
ArrayList getCommandHistoryList()
ArrayList getCommandHistoryList()
Connection getConnection(String driver, String databaseUrl, String user, String password)
Open a database connection.
Connection getConnection(String driver, String databaseUrl, String user, String password) throws SQLException
Open a database connection.
Parameters:
driver - the driver class name
databaseUrl - the database URL
user - the user name
password - the password
Returns:
the database connection
byte[] getFile(String file)
Read the given file from the file system or from the resources.
byte[] getFile(String file) throws IOException
Read the given file from the file system or from the resources.
Parameters:
file - the file name
Returns:
the data
String getName()
String getName()
int getPort()
int getPort()
boolean getSSL()
boolean getSSL()
WebSession getSession(String sessionId)
Get the web session object for the given session id.
WebSession getSession(String sessionId)
Get the web session object for the given session id.
Parameters:
sessionId - the session id
Returns:
the web session or null
ArrayList getSessions()
ArrayList getSessions()
ConnectionInfo getSetting(String name)
Get the connection information for this setting.
ConnectionInfo getSetting(String name)
Get the connection information for this setting.
Parameters:
name - the setting name
Returns:
the connection information
String[] getSettingNames()
Get the list of connection information setting names.
String[] getSettingNames()
Get the list of connection information setting names.
Returns:
the connection info names
ArrayList getSettings()
Get the list of connection info objects.
ArrayList getSettings()
Get the list of connection info objects.
Returns:
the list
String getStartDateTime()
String getStartDateTime()
String getType()
String getType()
String getURL()
String getURL()
void init(String... args)
void init(String... args)
boolean isCommandHistoryAllowed()
boolean isCommandHistoryAllowed()
boolean isDaemon()
boolean isDaemon()
boolean isRunning(boolean traceError)
boolean isRunning(boolean traceError)
boolean isStopped()
boolean isStopped()
void listen()
void listen()
void readTranslations(WebSession session, String language)
Read the translation for this language and save them in the 'text' property of this session.
void readTranslations(WebSession session, String language)
Read the translation for this language and save them in the 'text' property of this session.
Parameters:
session - the session
language - the language
void remove(WebThread t)
Remove this web thread from the set of running threads.
void remove(WebThread t)
Remove this web thread from the set of running threads.
Parameters:
t - the thread to remove
void removeSetting(String name)
Remove a connection information setting from the list
void removeSetting(String name)
Remove a connection information setting from the list
Parameters:
name - the setting to remove
void saveCommandHistoryList(ArrayList commandHistory)
Save the command history to the properties file.
void saveCommandHistoryList(ArrayList commandHistory)
Save the command history to the properties file.
Parameters:
commandHistory - the history
void saveProperties(Properties prop)
Save the settings to the properties file.
void saveProperties(Properties prop)
Save the settings to the properties file.
Parameters:
prop - null or the properties webPort, webAllowOthers, and webSSL
void setAllowChunked(boolean allowChunked)
void setAllowChunked(boolean allowChunked)
void setAllowOthers(boolean b)
void setAllowOthers(boolean b)
void setCommandHistoryAllowed(boolean allowed)
void setCommandHistoryAllowed(boolean allowed)
void setPort(int port)
void setPort(int port)
void setSSL(boolean b)
void setSSL(boolean b)
void setShutdownHandler(ShutdownHandler shutdownHandler)
void setShutdownHandler(ShutdownHandler shutdownHandler)
void shutdown()
Shut down the web server.
void shutdown()
Shut down the web server.
void start()
void start()
String startTranslate(Map translation)
Start the translation thread that reads the file once a second.
String startTranslate(Map translation)
Start the translation thread that reads the file once a second.
Parameters:
translation - the translation map
Returns:
the name of the file to translate
void stop()
void stop()
boolean supportsLanguage(String language)
Check if this language is supported / translated.
boolean supportsLanguage(String language)
Check if this language is supported / translated.
Parameters:
language - the language
Returns:
true if a translation is available
void trace(String s)
Write trace information if trace is enabled.
void trace(String s)
Write trace information if trace is enabled.
Parameters:
s - the message to write
void traceError(Throwable e)
Write the stack trace if trace is enabled.
void traceError(Throwable e)
Write the stack trace if trace is enabled.
Parameters:
e - the exception
void updateSetting(ConnectionInfo info)
Update a connection information setting.
void updateSetting(ConnectionInfo info)
Update a connection information setting.
Parameters:
info - the connection information