Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/actions/maven-github-settings/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Creates Maven settings.xml with auth for github and github-xqts-runner.
# Required for resolving from maven.pkg.github.com/eXist-db/exist and exist-xqts-runner.
# Creates Maven settings.xml with auth for the eXist-db org's GitHub Packages repos.
# Required for resolving artifacts from maven.pkg.github.com/eXist-db/{exist, exist-xqts-runner, jackrabbit-webdav-jakarta}.
name: Maven GitHub Packages settings
description: Create settings.xml with github and github-xqts-runner servers
description: Create settings.xml with github, github-xqts-runner, and github-jackrabbit-webdav-jakarta servers
inputs:
token:
description: 'GitHub token for package authentication'
Expand All @@ -27,6 +27,11 @@ runs:
<username>${OWNER}</username>
<password>${{ inputs.token }}</password>
</server>
<server>
<id>github-jackrabbit-webdav-jakarta</id>
<username>${OWNER}</username>
<password>${{ inputs.token }}</password>
</server>
</servers>
</settings>
EOF
3 changes: 3 additions & 0 deletions .github/workflows/ci-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
uses: docker/setup-buildx-action@v4
id: buildx
- uses: ./.github/actions/maven-cache
- uses: ./.github/actions/maven-github-settings
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install bats
run: sudo apt-get install bats
# Hack around #5450
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
- uses: ./.github/actions/maven-cache
with:
java-version: ${{ matrix.java-version }}
- uses: ./.github/actions/maven-github-settings
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Maven Daemon
id: install-mvnd
uses: ./.github/actions/install-mvnd
Expand Down
54 changes: 14 additions & 40 deletions exist-distribution/src/main/xslt/web.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,12 @@

<xsl:template match="jee:servlet[jee:servlet-name eq 'JMXServlet']" exclude-result-prefixes="jee">
<xsl:copy-of select="."/>

<xsl:comment>
Milton provides the WebDAV interface
</xsl:comment>
<servlet>
<servlet-name>milton</servlet-name>
<servlet-class>org.exist.webdav.MiltonWebDAVServlet</servlet-class>

<init-param>
<param-name>resource.factory.class</param-name>
<param-value>org.exist.webdav.ExistResourceFactory</param-value>
</init-param>

<xsl:comment>
Some WebDAV clients send a "Expect: 100-continue" header before
uploading body data. Servlet containers (like tomcat and jetty) handle
the header in a wrong way, making a client not work OK.
Set value to TRUE to restore old behavior (FALSE is the new default
value, hardcoded in MiltonWebDAVServlet).
</xsl:comment>
<xsl:text disable-output-escaping="yes">
&lt;!-- </xsl:text>
<init-param>
<param-name>enable.expect.continue</param-name>
<param-value>false</param-value>
</init-param>
<xsl:text disable-output-escaping="yes">
--&gt;
</xsl:text>
<xsl:comment>
Uncomment to enable debugging
</xsl:comment>
<xsl:text disable-output-escaping="yes">
&lt;!-- </xsl:text>
<init-param>
<param-name>filter_0</param-name>
<param-value>com.bradmcevoy.http.DebugFilter</param-value>
</init-param>
<xsl:text disable-output-escaping="yes">
--&gt;
</xsl:text>
<xsl:comment> Jackrabbit provides the WebDAV interface </xsl:comment>
<servlet>
<servlet-name>webdav</servlet-name>
<servlet-class>org.exist.webdav.ExistWebdavServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
</xsl:template>

Expand All @@ -87,6 +52,15 @@
</servlet>
</xsl:template>

<!-- Map WebDAV servlet directly — bypasses XQueryURLRewrite -->
<xsl:template match="jee:servlet-mapping[jee:servlet-name eq 'XQueryURLRewrite']" exclude-result-prefixes="jee">
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/webdav/*</url-pattern>
</servlet-mapping>
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
Expand Down
61 changes: 61 additions & 0 deletions exist-docker/src/test/bats/04-webdav-litmus.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bats

# WebDAV compliance tests using the litmus test suite
# (https://github.com/notroj/litmus). Runs against the WebDAV endpoint
# of the exist-ci container started by ci-container.yml.
#
# litmus is installed from apt (Ubuntu packages a stable release as the
# 'litmus' package) rather than built from upstream master, which keeps
# the test decoupled from upstream-build instability and avoids the
# autoreconf + neon-submodule + autogen.sh dance.
#
# To run locally on macOS, install litmus via MacPorts (`sudo port
# install litmus`) or build from source; on Linux, `sudo apt-get install
# litmus`.

WEBDAV_URL=http://localhost:8080/exist/webdav/db/
ADMIN_USER=admin
ADMIN_PASSWORD=""

LITMUS_RESULTS=/tmp/litmus-results.txt
BASELINE=extensions/webdav/src/test/resources/litmus-baseline.txt
CHECK_SCRIPT=extensions/webdav/src/test/resources/litmus-check.sh

setup_file() {
if ! command -v litmus >/dev/null 2>&1; then
if [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then
sudo apt-get install -y -qq litmus >/dev/null
else
echo "litmus binary not in PATH and apt unavailable; install litmus locally to run this test." >&2
return 1
fi
fi
}

@test "WebDAV PROPFIND responds with multistatus (207)" {
status_code=$(curl -s -o /dev/null -w '%{http_code}' \
-u "${ADMIN_USER}:${ADMIN_PASSWORD}" \
-X PROPFIND "${WEBDAV_URL}")
[ "$status_code" = "207" ]
}

@test "litmus basic suite passes" {
run litmus "${WEBDAV_URL}" "${ADMIN_USER}" "${ADMIN_PASSWORD}"
# litmus exits 0 even with failures; capture output for the
# next test to evaluate via litmus-check.sh.
echo "$output" > "${LITMUS_RESULTS}"
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
# Quick sanity: the basic suite must complete.
echo "$output" | grep -q "summary for \`basic'"
}

@test "litmus results match expected-failure baseline" {
[ -f "${LITMUS_RESULTS}" ] || skip "litmus did not run"
[ -f "${BASELINE}" ] || skip "baseline file missing"
[ -f "${CHECK_SCRIPT}" ] || skip "check script missing"
run bash "${CHECK_SCRIPT}" "${LITMUS_RESULTS}" "${BASELINE}"
if [ "$status" -ne 0 ]; then
echo "$output" >&2
fi
[ "$status" -eq 0 ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- XMLRPC servlet -->
<forward pattern="/xmlrpc" servlet="org.exist.xmlrpc.RpcServlet"/>
<!-- WebDAV interface -->
<forward pattern="/webdav/" servlet="milton"/>
<forward pattern="/webdav/" servlet="webdav"/>

<!-- RESTXQ -->
<forward pattern="/restxq/" servlet="RestXqServlet"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<forward pattern="/(rest|servlet)/" servlet="EXistServlet"/>

<!-- WebDAV interface -->
<forward pattern="/webdav/" servlet="milton"/>
<forward pattern="/webdav/" servlet="webdav"/>

<!-- RESTXQ -->
<forward pattern="/restxq/" servlet="RestXqServlet"/>
Expand Down
18 changes: 18 additions & 0 deletions exist-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@
<version>${milton.servlet.version}</version>
</dependency>

<!-- Jackrabbit WebDAV (Jakarta EE 10 transformed) -->
<dependency>
<groupId>org.exist-db.thirdparty.org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<version>2.22.3-jakarta-ee10</version>
</dependency>

<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
Expand Down Expand Up @@ -671,6 +678,17 @@
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>github-jackrabbit-webdav-jakarta</id>
<name>GitHub Registry - jackrabbit-webdav-jakarta</name>
<url>https://maven.pkg.github.com/eXist-db/jackrabbit-webdav-jakarta</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>exist-db-snapshots</id>
<name>eXist-db Snapshots</name>
Expand Down
44 changes: 8 additions & 36 deletions extensions/webdav/dat/metainf/web-fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,19 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

-->
<web-fragment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
id="WebDAV" version="3.0">
<web-fragment xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-fragment_6_0.xsd"
id="WebDAV" version="6.0">

<name>WebDAV</name>

<!--
Milton provides the WebDAV interface
Jackrabbit provides the WebDAV interface
-->
<servlet>
<servlet-name>milton</servlet-name>
<servlet-class>org.exist.webdav.MiltonWebDAVServlet</servlet-class>

<!-- Don't change this value -->
<init-param>
<param-name>resource.factory.class</param-name>
<param-value>org.exist.webdav.ExistResourceFactory</param-value>
</init-param>

<!--
Some WebDAV clients send a "Expect: 100-continue" header before
uploading body data. Servlet containers (like tomcat and jetty) handle
the header in a wrong way, making a client not work OK.
Set value to TRUE to restore old behavior (FALSE is the new default
value, hardcoded in MiltonWebDAVServlet).
-->
<!--
<init-param>
<param-name>enable.expect.continue</param-name>
<param-value>false</param-value>
</init-param>
-->

<!-- Uncomment to enable debugging -->
<!--
<init-param>
<param-name>filter_0</param-name>
<param-value>com.bradmcevoy.http.DebugFilter</param-value>
</init-param>
-->
<servlet-name>webdav</servlet-name>
<servlet-class>org.exist.webdav.ExistWebdavServlet</servlet-class>
</servlet>

</web-fragment>
66 changes: 25 additions & 41 deletions extensions/webdav/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,50 +61,14 @@
<version>1.11.0</version>
</dependency>

<!-- Jackrabbit WebDAV (Jakarta EE 10 transformed) -->
<dependency>
<groupId>org.exist-db.thirdparty.com.ettrema</groupId>
<artifactId>milton-api</artifactId>
<exclusions>
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1.3</version>
<scope>runtime</scope>
<groupId>org.exist-db.thirdparty.org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
</dependency>

<dependency>
<groupId>com.evolvedbinary.thirdparty.com.ettrema</groupId>
<artifactId>milton-servlet</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Milton server dependencies removed — replaced by Jackrabbit WebDAV -->
<!-- Milton client kept for test suite -->

<dependency>
<groupId>jakarta.servlet</groupId>
Expand All @@ -128,11 +92,17 @@
<scope>test</scope>
</dependency>

<!-- Milton client + API kept for WebDAV test suite -->
<dependency>
<groupId>org.exist-db.thirdparty.com.ettrema</groupId>
<artifactId>milton-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.exist-db.thirdparty.com.ettrema</groupId>
<artifactId>milton-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down Expand Up @@ -210,6 +180,20 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<licenseSets>
<licenseSet>
<excludes>
<exclude>src/test/resources/litmus-baseline.txt</exclude>
<exclude>src/test/resources/litmus-check.sh</exclude>
</excludes>
</licenseSet>
</licenseSets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Loading
Loading