Top Description Fields Constructors Methods
org.hsqldb.server

public Class WebServer

extends Server
Class Inheritance
Imports
org.hsqldb.lib.FileUtil, org.hsqldb.persist.HsqlProperties, org.hsqldb.resources.ResourceBundleHandler

The HyperSQL http: and https: protocol network database server.

WebServer has two distinct functions:

The primary function is to allow client/server access to HSQLDB databases via the HTTP protocol. This protocol is less efficient than the HSQL protocol used by the Server class and should be used only in situations where sandboxes or firewalls between the client and the server do not allow the use of the HSQL protocol. One example is client/server access by an applet running in browsers on remote hosts and accessing the database engine on the HTTP server from which the applet originated. From version 1.7.2, HTTP database connections are persistent and support transactions. Similar to HSQL connections, they should be explicitly closed to free the server resources.

The secondary function of WebServer is to act as a simple general purpose HTTP server. It is aimed to support the minimum requirements set out by the HTTP/1.0 standard. The HEAD and GET methods can be used to query and retrieve static files from the HTTP server.

Both the database server and HTTP server functions of WebServer can be configured with the webserver.properties file. It contains entries for the database server similar to those for the HSQL protocol Server class. In addition, a list mapping different file endings to their mime types may be included in this file. (fredt@users)

From the command line, the options are as follows:

+-----------------+-------------+----------+------------------------------+
|    OPTION       |    TYPE     | DEFAULT  |         DESCRIPTION          |
+-----------------+-------------+----------+------------------------------|
| --help          |             |          | prints this message          |
| --address       | name|number | any      | server inet address          |
| --port          | number      | 80       | port at which server listens |
| --database.i    | [type]spec  | 0=test   | path of database i           |
| --dbname.i      | alias       |          | url alias for database i     |
| --silent        | true|false  | true     | false => display all queries |
| --trace         | true|false  | false    | display JDBC trace messages  |
| --no_system_exit| true|false  | false    | do not issue System.exit()   |
+-----------------+-------------+----------+------------------------------+
Example of the webserver.properties file:
server.port=80
server.database.0=test
server.dbname.0=...
...
server.database.n=...
server.dbname.n=...
server.silent=true

.htm=text/html
.html=text/html
.txt=text/plain
.gif=image/gif
.class=application/octet-stream
.jpg=image/jpeg
.jgep=image/jpeg
.zip=application/x-zip-compressed
Authors
Campbell Burnet (campbell-burnet@users dot sourceforge.net), Fred Toussi (fredt@users dot sourceforge.net)
Since
1.7.2
Version
1.7.2

Field Summary

Modifier and TypeField and Description
pack-priv static int
webBundleHandle

Handle to resource bundle providing i18n for things like HTTP error pages.

Inherited from org.hsqldb.server.Server:
actionSequencealiasSetdbActionSequencedbAliasdbIDdbPathdbPropsdbTypeisDaemonisRemoteOpenmaxConnectionsmaxWaitForClientDataserverBundleHandleserverConnectionThreadGroupserverConnSetserverConnSetSyncserverIdserverPropertiesserverProtocolsocketsocketFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name of the web page served when no page is specified
getDefaultWebPage
()

Overrides org.hsqldb.server.Server.getDefaultWebPage.

Retrieves the name of the web page served when no page is specified.

public String

Returns:

the command line and properties options help for this Server
getHelpString
()

Overrides org.hsqldb.server.Server.getHelpString.

Retrieves a String object describing the command line and properties options for this Server.

public String

Returns:

the product name of this server
getProductName
()

Overrides org.hsqldb.server.Server.getProductName.

Retrieves this server's product name.

public String

Returns:

string representation of this server's protocol
getProtocol
()

Overrides org.hsqldb.server.Server.getProtocol.

Retrieves a string representation of the network protocol this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.

public String

Returns:

the root context (directory) from which web content is served
getWebRoot
()

Overrides org.hsqldb.server.Server.getWebRoot.

Retrieves the root context (directory) from which web content is served.

public static void
main(String[]
the "command line" parameters with which to start the WebServer. "-?" will cause the command line arguments help to be printed to the standard output
args
)

Hides org.hsqldb.server.Server.main.

Starts a new WebServer.

Inherited from org.hsqldb.server.Server:
allowConnectioncheckRunningcloseOldestDatabasegetAddressgetDatabaseNamegetDatabasePathgetDatabaseTypegetDBIndexgetErrWritergetFirstEmptyDatabaseIndexgetLocalPortgetLogWritergetMaxWaitgetPortgetProductVersiongetServerErrorgetServerIdgetServerThreadgetStategetStateDescriptorhandleConnectioninitisNoSystemExitisNotRunningisRestartOnShutdownisSilentisTlsisTracenotifyopenDatabaseopenDatabasesprintprintErrorprintHelpprintPropertiesprintRequestprintResourceprintStackTraceprintWithThreadprintWithTimestampputPropertiesFromFileputPropertiesFromFileputPropertiesFromStringreleaseDatabasesetActionSequencesetAddresssetDaemonsetDatabaseNamesetDatabasePathsetDefaultWebPagesetErrWritersetLogWritersetMaxWaitsetNoSystemExitsetPortsetPropertiessetPropertiessetRestartOnShutdownsetServerErrorsetSilentsetStatesetTlssetTracesetWebRootshutdownshutdownshutdownCatalogsshutdownWithCatalogssignalCloseAllServerConnectionsstartstop

Field Detail

webBundleHandleback to summary
pack-priv static int webBundleHandle

Handle to resource bundle providing i18n for things like HTTP error pages.

Constructor Detail

WebServerback to summary
public WebServer()

Method Detail

getDefaultWebPageback to summary
public String getDefaultWebPage()

Overrides org.hsqldb.server.Server.getDefaultWebPage.

Retrieves the name of the web page served when no page is specified. This attribute is relevant only when server protocol is HTTP(S).

Returns:String

the name of the web page served when no page is specified

getHelpStringback to summary
public String getHelpString()

Overrides org.hsqldb.server.Server.getHelpString.

Retrieves a String object describing the command line and properties options for this Server.

Returns:String

the command line and properties options help for this Server

getProductNameback to summary
public String getProductName()

Overrides org.hsqldb.server.Server.getProductName.

Retrieves this server's product name.

Typically, this will be something like: "HSQLDB xxx server".

Returns:String

the product name of this server

getProtocolback to summary
public String getProtocol()

Overrides org.hsqldb.server.Server.getProtocol.

Retrieves a string representation of the network protocol this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.

Returns:String

string representation of this server's protocol

getWebRootback to summary
public String getWebRoot()

Overrides org.hsqldb.server.Server.getWebRoot.

Retrieves the root context (directory) from which web content is served. This property is relevant only when the server protocol is HTTP(S). Although unlikely, it may be that in the future other contexts, such as jar urls may be supported, so that pages can be served from the contents of a jar or from the JVM class path.

Returns:String

the root context (directory) from which web content is served

mainback to summary
public static void main(String[] args)

Hides org.hsqldb.server.Server.main.

Starts a new WebServer.

Parameters
args:String[]

the "command line" parameters with which to start the WebServer. "-?" will cause the command line arguments help to be printed to the standard output