eclipse-ee4j / eclipse-ee4j/jersey

NettyHttpContainerProvider not binding to specified hostname

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

Description

With `org.glassfish.jersey.netty.httpserver.NettyHttpContainerProvider` (jersey-container-netty-http version 2.28), it is impossible to bind to a specific network address/hostname. Both the `createServer` and `createHttp2Server` methods use `b.bind(port)` instead of `b.bind(inetHost, port)`.

A workaround is not so easy to do, as the NettyHttpContainer class is package-private (so my ugly workaround is to create a new class in the org.glassfish.jersey.netty.httpserver package, and copy the code of NettyHttpContainerProvider).

Please compare the implementation to e.g. org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory#createHttpServer , which uses

`final String host = (uri.getHost() == null) ? NetworkListener.DEFAULT_NETWORK_HOST : uri.getHost();`

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.