<?xml version="1.0" encoding="UTF-8"?>
<web-app 
  xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_4_0.xsd" 
  version="4.0">
    
  <display-name>BaseX: The XML Database and XQuery Processor</display-name>
  <description>HTTP Services</description>
    
  <!-- A BaseX option can be overwritten by prefixing the key with "org.basex."
     and specifying it in <context-param/> elements, as shown below.
     Check out https://docs.basex.org/wiki/Options for a list of all options.

  <context-param>
    <param-name>org.basex.restxqpath</param-name>
    <param-value>.</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.dbpath</param-name>
    <param-value>WEB-INF/data</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.repopath</param-name>
    <param-value>WEB-INF/repo</param-value>
  </context-param>

  <context-param>
    <param-name>org.basex.user</param-name>
    <param-value>admin</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.authmethod</param-name>
    <param-value>Digest</param-value>
  </context-param>

  <context-param>
    <param-name>org.basex.httplocal</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.timeout</param-name>
    <param-value>5</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.log</param-name>
    <param-value>false</param-value>
  </context-param>
  -->

  <!-- Global session and servlet listener -->
  <listener>
    <listener-class>org.basex.http.SessionListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.basex.http.ServletListener</listener-class>
  </listener>

  <!-- CORS in Jetty: Access-Control-Allow-Origin: *
  <filter>
    <filter-name>cross-origin</filter-name>
    <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
    <init-param>
      <param-name>allowedOrigins</param-name>
      <param-value>*</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>cross-origin</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  -->

  <!-- RESTXQ Service (can be disabled by removing this entry) -->
  <servlet>
    <servlet-name>RESTXQ</servlet-name>
    <servlet-class>org.basex.http.restxq.RestXqServlet</servlet-class>
    <init-param>
      <param-name>org.basex.user</param-name>
      <param-value>admin</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>RESTXQ</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <!-- WebSocket Service (can be disabled by removing this entry) -->
  <servlet>
    <servlet-name>WebSocket</servlet-name>
    <servlet-class>org.basex.http.ws.WsServlet</servlet-class>
    <!-- Limits of the WebSocket connection
    <init-param>
      <param-name>maxIdleTime</param-name>
      <param-value>100000</param-value>
    </init-param>
    <init-param>
      <param-name>maxTextMessageSize</param-name>
      <param-value>3000</param-value>
    </init-param>
    <init-param>
      <param-name>maxBinaryMessageSize </param-name>
      <param-value>3000</param-value>
    </init-param>
    -->
  </servlet>
  <servlet-mapping>
    <servlet-name>WebSocket</servlet-name>
    <url-pattern>/ws/*</url-pattern>
  </servlet-mapping>

  <!-- REST Service (can be disabled by removing this entry) -->
  <servlet>
    <servlet-name>REST</servlet-name>
    <servlet-class>org.basex.http.rest.RESTServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>REST</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>

  <!-- WebDAV Service (can be disabled by removing this entry) -->
  <servlet>
    <servlet-name>WebDAV</servlet-name>
    <servlet-class>org.basex.http.webdav.WebDAVServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>WebDAV</servlet-name>
    <url-pattern>/webdav/*</url-pattern>
  </servlet-mapping>

  <!-- Mapping for static resources (may be restricted to a sub path) -->
  <servlet>
    <servlet-name>default</servlet-name>
    <init-param>
      <param-name>useFileMappedBuffer</param-name>
      <param-value>false</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/static/*</url-pattern>
  </servlet-mapping>

</web-app>
