Skip to content

Serve site:run with the JDK HTTP server instead of Jetty 9 - #1303

Merged
slachiewicz merged 1 commit into
masterfrom
site-run-without-jetty
Sep 3, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
site-run-without-jetty

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Fixes #1298. Estate-wide context: apache/maven#12768.

What and why

site:run embedded Jetty 9.4 at compile scope. 9.4.58.v20250814 is the last release of the 9.4 line — no version bump is possible and future CVEs in it will not be fixed publicly (jetty/jetty.project#13918).

site:run needs two things: serve a directory, and route document requests through the render-on-request loop. com.sun.net.httpserver.HttpServer (in the JDK since 6, jdk.httpserver module since 9) covers both, so this PR:

  • replaces DoxiaFilter (servlet Filter) with DoxiaHandler (HttpHandler) — same locale routing, welcome-file handling and external-report serving, plus path-traversal protection that the servlet container used to provide
  • rewrites SiteRunMojo on the JDK HTTP server (daemon executor, shutdown hook, port=0 supported as before)
  • ports the test DAV server (SimpleDavServerHandler) to the JDK HTTP server and merges the AuthAsyncProxyServlet proxy-auth gate into it (Basic Proxy-Authorization, 407 on failure) — no test ever used Jetty's actual forwarding path
  • removes all seven Jetty artifacts, javax.servlet-api and the jettyVersion property from the pom
  • drops the WEB-INF/web.xml dummy webapp and WebXmlTest

The Java 8 baseline is unchanged (option 2 — Jetty 12 — would have required 17).

Behavior notes

  • Rendered documents are now served with an explicit charset from the site's output encoding (previously the servlet container's default).
  • No 304/If-Modified-Since handling and no directory listings — both irrelevant for a loopback dev-preview server.
  • Headers are recorded lower-cased in the DAV tests, so their assertions now use lower-case names.

Verification

  • mvn verify green, 3/3 tests (both WebDAV deploy tests, incl. the proxy-auth 407 flow).
  • Pre-checked that the JDK server accepts absolute-form request targets (PUT http://toto.com/... HTTP/1.1) as sent through a proxy.
  • Live smoke on a markdown sample: / renders on demand (200 text/html; charset=UTF-8), skin css/png served with correct content types, unknown paths 404, and both /../ and %2e%2e/ traversal attempts blocked.

Jetty 9 is end of life: 9.4.58.v20250814 is the last release and future
CVEs in it will not be fixed publicly. site:run only needs to serve a
directory and render documents on request, which the JDK built-in
com.sun.net.httpserver.HttpServer covers, so the Java 8 baseline is kept
and the whole Jetty dependency tree leaves the pom.

The test DAV/proxy servers are ported to the JDK HTTP server as well,
which also drops javax.servlet-api.

Fixes #1298
@slachiewicz slachiewicz added dependencies Pull requests that update a dependency file maintenance labels Aug 31, 2026
@slachiewicz
slachiewicz merged commit cad2af8 into master Sep 3, 2026
16 checks passed
@slachiewicz
slachiewicz deleted the site-run-without-jetty branch September 3, 2026 22:51
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

@slachiewicz The PR can't be associated to a milestone, because there are multiple open milestones. Please add the text "branch: master" to the description to the milestone where this PR belongs to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

site:run embeds Jetty 9.4 at compile scope, which is now end of life

1 participant