[refactor] Migrate HTTP usage to Apache HttpClient 5; drop Milton + outdated HC4 deps#6473
[refactor] Migrate HTTP usage to Apache HttpClient 5; drop Milton + outdated HC4 deps#6473joewiz wants to merge 7 commits into
Conversation
Add HC5 BOM (httpclient5/httpclient5-fluent 5.6.1, httpcore5 5.4) alongside HC4 for hybrid coexistence. Migrate exist-core and extension HTTP tests to org.apache.hc.*; keep extensions/webdav on HC4 for milton-client JUnit tests. HC5 fluent Executor auth does not reliably attach Basic credentials to /exist/... URLs, so AbstractHttpTest adds a preemptive Authorization interceptor (same pattern in restxq and file module tests). Co-authored-by: Cursor <cursoragent@cursor.com>
Publish exist-core test-jar so extension ITs share AbstractHttpTest. Simplify auth to a preemptive Authorization interceptor only; add AuthenticatedHttpClientTest regression guard. Close HTTP responses in restxq helpers; dedupe auth in restxq/file. LoginModuleIT: disable retries and close responses. Document expath HC4/HC5 hybrid. Close MoveResourceTest connection pool after class.
Removes HC4/milton-client test harness from exist-webdav (Gate A). Litmus bats cover RFC compliance; WebDavRoundTripTest keeps eXist-specific XML serialization checks (DOCTYPE, xml-decl, CDATA).
These three tests landed on develop after the original HC5 branch (eXist-db#6393) and were still on HttpClient 4, so they broke once HC4 left the exist-core test classpath: - URLRewriteViewPipelineTest: fluent Request.Get/Put/Delete -> get/put/delete, HttpResponse -> ClassicHttpResponse, getStatusLine().getStatusCode() -> getCode(). - JmxRemoteTest: the vector-category tests used Request.Get (HC4) -> Request.get (HC5). - RestBinariesTest: restore an HC5 postXquery() returning ClassicHttpResponse for the response:stream-binary-resource tests (which read headers/entity); postXqueryBody() now delegates to it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Now that all eXist-owned HTTP code is on HttpClient 5, remove the outdated HC4 dependencies that nothing declares anymore: - exist-parent BOM: drop httpclient, httpmime and fluent-hc (HC4) and the now-unused apache.httpcomponents.version property. Keep httpcore (HC4) only, for expath. - exist-distribution log4j2.xml: drop the stale Milton (com.bradmcevoy) logger. - debuggee: inherit the BOM-managed httpclient5-fluent version instead of pinning 5.6.1. - expath: bump http-client-java 1.4.2 -> 1.5.2 (supersedes dependabot eXist-db#5346) and correct the pom note. EXistTreeBuilder still needs HC4 httpcore: the EXPath http-client-java library is HC4 even at 1.5.2 (its HeaderSet implements Iterable<org.apache.http.Header>), so httpcore cannot be dropped until that library migrates to HC5. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dizzzz
left a comment
There was a problem hiding this comment.
LGTM - I was wondering if we could not ditch apache http client and simplify stuff by using the native Java9+ HttpClient (with optionally the Methanol library where needed for specials)
|
Are there still sufficient webdav tests? @joewiz I recall you introduced a 3rd party test framework right? |
|
Thank you @joewiz looks good to me. There might be room for more optimizations but this seems to capture the bulk of it and is a big step in the right directions. |
|
[This response was co-authored with Claude Code. -Joe] Superseded by #6482, which takes the EXPath HTTP client native on the JDK |
[This PR was co-authored with Claude Code. -Joe]
Continues and supersedes #6393 by @duncdrum (his commits are preserved here, rebased onto current
develop). Picks up where that draft left off now that Saxon 12, Jackrabbit WebDAV (#6364), and Jetty 12 (#6392) have all landed.Summary
Migrates eXist-owned HTTP usage from Apache HttpClient 4.x to HttpClient 5.x across the code base, removes the dead Milton WebDAV test infrastructure that #6364 left behind, and drops the now-unused HC4 dependencies. Goal: consistent HTTP interactions throughout, and fewer outdated deps.
What changed
@duncdrum's work (rebased, authorship preserved): integration tests + eXist-owned HTTP code migrated HC4 → HC5 (5.6.1); removed the 8 milton-client WebDAV tests +
com.ettremastubs, added JDK-HttpClient round-trip tests (WebDavRoundTripTest,WebDavHttpTest); standaloneweb.xmluses the Jackrabbit servlet.Finishing work (this continuation):
developadded after the original branch and still on HC4:URLRewriteViewPipelineTest, the vector tests inJmxRemoteTest, andRestBinariesTest(restored an HC5postXqueryreturningClassicHttpResponsefor theresponse:stream-binary-resourcetests;postXqueryBodydelegates to it).httpclient/httpmime/fluent-hcfrom the parent BOM + the unusedapache.httpcomponents.versionproperty.exist-distributionlog4j2.xml;debuggeeinherits the BOM-managed HC5 version; bumpedhttp-client-java1.4.2 → 1.5.2 (supersedes dependabot Bump org.expath.http.client:http-client-java from 1.4.2 to 1.5.2 #5346).One HC4 dependency remains, and why
extensions/expathkeeps HC4httpcore— solely forEXistTreeBuilder, which iteratesorg.apache.http.Headerexposed by the EXPathhttp-client-javalibrary. That library is still HC4 at its latest release:http-client-java 1.5.2'sHeaderSet implements Iterable<org.apache.http.Header>, identical to 1.4.2. So full HC4 removal isn't possible untilhttp-client-javaitself migrates to HC5;httpcore(HC4) is scoped to expath and documented in its pom.Test plan
exist-xqtsneeds GitHub Packages auth — environment, not code)