org.hsqldb
Class WebServer

java.lang.Object
  extended byorg.hsqldb.Server
      extended byorg.hsqldb.WebServer
All Implemented Interfaces:
HsqlSocketRequestHandler

public class WebServer
extends Server

The HSQLDB HTTP 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 retreive 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)

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
 

Version:
1.7.2

Field Summary
 
Fields inherited from class org.hsqldb.Server
serverBundleHandle, serverConnectionThreadGroup, serverId, serverProtocol, socket, socketFactory
 
Constructor Summary
WebServer()
           
 
Method Summary
 String getDefaultPropertiesPath()
          Retrieves the path that will be used by default if a null or zero-length path is specified to putPropertiesFromFile().
 String getDefaultWebPage()
          Retrieves the name of the web page served when no page is specified.
 String getHelpString()
          Retrieves a String object describing the command line and properties options for this Server.
 String getProductName()
          Retrieves this server's product name.
 String getProtocol()
          Retrieves a string respresentaion of the network protocol this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.
 String getWebRoot()
          Retrieves the root context (directory) from which web content is served.
static void main(String[] args)
          Starts a new WebServer.
 
Methods inherited from class org.hsqldb.Server
allowConnection, checkRunning, finalize, getAddress, getDatabaseName, getDatabasePath, getDefaultPort, getErrWriter, getLogWriter, getPort, getProductVersion, getPropertiesFromFile, getServerError, getServerId, getState, getStateDescriptor, handleConnection, init, isNoSystemExit, isRestartOnShutdown, isSilent, isTls, isTrace, listLocalInetAddressNames, print, printError, printHelp, printStackTrace, printWithThread, putPropertiesFromFile, putPropertiesFromString, setAddress, setDatabaseName, setDatabasePath, setDefaultWebPage, setErrWriter, setLogWriter, setNoSystemExit, setPort, setProperties, setRestartOnShutdown, setServerError, setSilent, setState, setTls, setTrace, setWebRoot, signalCloseAllServerConnections, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebServer

public WebServer()
Method Detail

main

public static void main(String[] args)
Starts a new WebServer.

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

getDefaultPropertiesPath

public String getDefaultPropertiesPath()
Retrieves the path that will be used by default if a null or zero-length path is specified to putPropertiesFromFile(). This path does not include the '.properties' file extention, which is implicit. NB Campbell - this method is misleading and should be removed - default properties path is for the main() method only.

Overrides:
getDefaultPropertiesPath in class Server
Returns:
The path that will be used by default if null is specified to putPropertiesFromFile()

getDefaultWebPage

public String 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).

Overrides:
getDefaultWebPage in class Server
Returns:
the name of the web page served when no page is specified

getHelpString

public String getHelpString()
Retrieves a String object describing the command line and properties options for this Server.

Overrides:
getHelpString in class Server
Returns:
the command line and properties options help for this Server

getProductName

public String getProductName()
Retrieves this server's product name.

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

Overrides:
getProductName in class Server
Returns:
the product name of this server

getProtocol

public String getProtocol()
Retrieves a string respresentaion of the network protocol this server offers, typically one of 'HTTP', HTTPS', 'HSQL' or 'HSQLS'.

Overrides:
getProtocol in class Server
Returns:
string respresentation of this server's protocol

getWebRoot

public String 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.

Overrides:
getWebRoot in class Server
Returns:
the root context (directory) from which web content is served


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.