eclipse-ee4j / eclipse-ee4j/jersey

netty container disregards path component of baseUri

Open
#4,046 1 comment 0 reactions 0 assignees View on GitHub
Component: connectors Component: containers netty
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

No matter, which path component is specified in the baseUri when creating the server via org.glassfish.jersey.netty.httpserver.NettyHttpContainerProvider#createHttp2Server (probably the same for `createServer`?), all the resources are located relative to "/".

e.g. use a `@Path("example")` resource together with `createHttp2Server(URI.create("http://localhost:13333/abc/"), rc, ...)`

The client sees the resource wrongly located at "http://localhost:13333/example".

Using the debugger, I found the problem to be in org.glassfish.jersey.netty.httpserver.JerseyHttp2ServerHandler#createContainerRequest . The issue is, that it creates the `requestUri` from the baseUri + the path from the HTTP header, so it believes, the HTTP request was for "http://localhost:13333/abc/example".

Note: Please compare this with `GrizzlyHttpServerFactory.createHttpServer(URI.create("http://localhost:13333/abc/", rc, ...)`, which behaves correctly. (There, the client sees the resource at "http://localhost:13333/abc/example")

Versions:
- jersey-container-netty-http version 2.28
- jersey-container-grizzly2-http 2.28

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.