BaseX provides access to stored database resources and to the XQuery engine via REST, RESTXQ and WebDAV services. This article describes different way of deploying and configuring these services. The services can be deployed in 3 different ways:
- as a standalone application,
- as web servlets in a J2EE servlet container,
- and for development purposes, using maven.
Standalone: BaseX HTTP Server
In order to deploy BaseX HTTP Services in a servlet container, one needs to download the WAR distribution of BaseX from the download site. The downloaded WAR file can be then deployed following the instructions of the corresponding servlet container (jetty, tomcat).
There are two ways in which the BaseX web application can access databases:
- either a dedicated database server should be manually started,
- or the web application will access and store data on the local file system.
The operation mode can be configured as explained further below.
Note: when the web application stores data in the local file system of the servlet container, then by default it will use a separate directory as home directory. This is because, in many production environments, the servlet container runs as a dedicated user without a
$HOME directory. However BaseX needs to store somewhere it's settings and data. This is why, even when running a servlet container with a normal user (i.e. one which has a
$HOME directory), the web application will not use by the default the settings stored in
$HOME/.basex and will have a different set (or empty set) of databases than the one in the case of the standalone HTTP server. However, this behavior can be changed by manually setting the BaseX home directory to
$HOME, in which case the web application will use the same databases as in the case of the standalone server.
Servlet Container Configuration
Configuring port, context path, etc. can be done following the corresponding instructions of the used servlet container.
Configuring Available Services
To enable or disable one of the provided services, the corresponding servlet entry in the
web.xml file needs to be removed/commented.
Configuring Database Access
The following options are available to configure the way the databases are accessed. These can be set in the
web.xml file or as Java system variables (e.g. using
-Dorg.basex.path="/some/path" from the command line).
||Path to the BaseX home directory, in which the |
||Operation mode. By default, the value is "|
||Database user. By default, no value is specified, and the credentials must be specified by the client. Note that it is a clear security risk to store user credentials in the |
||Database user password.|
Checkout the sources of basex and basex-api as described under Integrate: Check Out. Execute
mvn install in the basex project folder and then
mvn install jetty:run in the basex-api project folder. This will start a Jetty instance in which the servlets will be deployed.
The same options as in the case of deployment in a servlet container apply. For configuring various Jetty runtime options, such as port, context path, etc. refer to the Maven Jetty Plugin. These should be entered in the
pom.xml file of the