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();