eclipse-ee4j / eclipse-ee4j/jersey

JettyHttpContainer URL handling broken

Open
#3,338 6 comments 0 reactions 0 assignees View on GitHub
Component: containers Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

I'm creating a JAX-RS server using the jetty http container. The resource
is annotated with @Path("/services") and the whole JAX-RS handler is put under context "/my/path" (see code snippet below for details)

So an HTTP GET on /my/path/service should end up in my rest resource. However, it does not on 2.22.2\.

After stepping through the code, it seems that the JettyHttpContainer.handle constructs a wrong requestUri:"http://localhost:52021/my/path/my/path/services"
(notice the duplication of /my/path)

It is related to fixed done in scope of [https://github.com/jersey/jersey/commit/239d02fcc0792155eb5aaf51e5c2b68e61203c19#diff-1997febdf388bca1dd941929123602df](https://github.com/jersey/jersey/commit/239d02fcc0792155eb5aaf51e5c2b68e61203c19#diff-1997febdf388bca1dd941929123602df)

I have reverted back to 2.21.1, which works fine.

```
ContextHandler context = new ContextHandler();
final Handler endpoint = RuntimeDelegate.getInstance().createEndpoint(application, Handler.class);

context.setHandler(endpoint);
context.setContextPath("/my/path");
```
#### Affected Versions
[2.22.2]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.