Changes

Jump to navigation Jump to search
555 bytes removed ,  11:08, 22 October 2018
no edit summary
This page is part of the [[Getting Started]] Section. It describes how BaseX can be used to both provide simple APIs and build complex web applications. The following services are provided:
* {| class="wikitable" |- valign="top"! Name! Path! Description|- valign="top"| [[RESTXQ]] allows you to write more complex | <code>/</code>| Write enriched APIs and full web applications with XQuery;.|- valign="top"* | [[WebSockets]] can be used to write web services with full| <code>/ws</code>| Bidirectional client/server communication.|-duplex web communication;valign="top"* | [[REST]] offers a straightforward RESTful API for accessing database | <code>/rest</code>| Straightforward access to XML databases and its resources via URLs; and.|- valign="top"* | [[WebDAV]] gives you | <code>/rest</code>| Database access to databases via the file system.|- valign="top"| Default| <code>/static</code>| Access to static server resources (HTML, JavaScript, CSS, images, …).|} ==Available Services==
This article describes different ways of deploying and configuring these services. BaseX can be deployed as follows:
==Configuration==
All Initial database options can be specified in the {{Code|web.xml}} file. They need to be defined as context parameters and prefixed with {{Code|org.basex.}}. The most important options for the web application context are as follows:
{| class="wikitable"
|}
Path Local file paths in options may contain an be absolute or relative path. If a relative path is specified, its root will be the servlet ({{Code|webapp}}) path:
<pre class="brush:xml">
<context-param> <param-name>org.basex.dbpath</param-name> <!-- will be rewritten to ..../webapp/WEB-INF/data --> <param-value>WEB-INF/data</param-value> </context-param> <context-param> <param-name>org.basex.repopath</param-name> <!-- will be kept as is --> <param-value>f:/basex/repository</param-value> </context-param>
</pre>
Context parameters can be requested from XQuery via [[Process_Module#proc:property-names|proc:property-names]] and [[Process_Module#proc:property|proc:property]]. How to set these options is specific to the servlet container. For example, in Jetty it can be done by [http://www.eclipse.org/jetty/documentation/current/override-web-xml.html overriding the web.xml] file. Another option is to directly edit the {{Code|WEB-INF/web.xml}} file in the WAR archive (WAR files are simple ZIP files). Refer to the sample [https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/webapp/WEB-INF/web.xml web.xml] of the basex-api package.
 
To enable or disable a specific service, the corresponding servlet entry in the {{Code|web.xml}} file needs to be removed/commented.
==Authentication==
<pre class="brush:xml">
<servlet> <servlet-name>REST</servlet-name> <servlet-class>org.basex.http.rest.RESTServlet</servlet-class> <init-param> <param-name>org.basex.user</param-name> <param-value>rest-user</param-value> </init-param> </servlet>
</pre>
Users are specified in a {{Code|users.xml}} file, which is stored in the database directory (see [[User Management]] for more information).
 
==Available Services==
 
To enable or disable one of the provided services, the corresponding servlet entry in the {{Code|web.xml}} file needs to be removed/commented. The default URL paths are listed in the following table:
 
{| class="wikitable"
|- valign="top"
! Service
! URL
! Usage
|- valign="top"
| [[RESTXQ]]
| {{Code|http://[host]:[port]/[servlet_path]}}
| Create XQuery web services and applications.
|- valign="top"
| [[RESTXQ]]
| {{Code|ws://[host]:[port]/[servlet_path]/ws}}
| Bidirectional WebSocket communication.
|- valign="top"
| [[REST]]
| {{Code|http://[host]:[port]/[servlet_path]/rest}}
| Access XML database and its resources.
|- valign="top"
| [[WebDAV]]
| {{Code|(http|webdav)://[host]:[port]/[servlet_path]/webdav/}}
| Access databases via the filesystem.
|- valign="top"
| Default web server
| {{Code|http://[host]:[port]/[servlet_path]/static/}}
| Access your standard web files (e.g. HTML, JavaScript or CSS).
|}
=Maven=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu