Skip to content

Fix Jetty container context path handling - #6116

Draft
zenios wants to merge 1 commit into
eclipse-ee4j:4.xfrom
zenios:fix-jetty-context-path
Draft

Fix Jetty container context path handling#6116
zenios wants to merge 1 commit into
eclipse-ee4j:4.xfrom
zenios:fix-jetty-context-path

Conversation

@zenios

@zenios zenios commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • use Jetty's context-relative request path when constructing the Jersey request URI
  • add coverage for JettyHttpContainer mounted at both root and non-root context paths

Root cause

JettyHttpContainer used the full request path while also deriving its base URI from the Jetty context path. A request for /context/resource was therefore constructed as /context/context/resource and failed resource matching.

Using Request.getPathInContext(request) preserves the context path in the base URI while appending only the part of the request path that is relative to that context.

Impact

Jersey resources mounted under a non-root Jetty ContextHandler now route correctly. Root-context routing remains unchanged, UriInfo exposes the expected base and request URIs, and query parameters are preserved.

Testing

  • mvnd -pl containers/jetty-http -am test -DskipTests=false
  • verified that the regression test passes at / but fails with 404 at /context without the fix

Fixes #3338

Signed-off-by: Dimitris Zenios <dimitris.zenios@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JettyHttpContainer URL handling broken

1 participant