Update JdkHttpServerFactory.java (#5163)
diff --git a/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerFactory.java b/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerFactory.java index 1743925..f312359 100644 --- a/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerFactory.java +++ b/containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerFactory.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -223,11 +223,15 @@ ? (isHttp ? Container.DEFAULT_HTTP_PORT : Container.DEFAULT_HTTPS_PORT) : uri.getPort(); + final InetSocketAddress socketAddress = (uri.getHost() == null) + ? new InetSocketAddress(port) + : new InetSocketAddress(uri.getHost(), port); + final HttpServer server; try { server = isHttp - ? HttpServer.create(new InetSocketAddress(port), 0) - : HttpsServer.create(new InetSocketAddress(port), 0); + ? HttpServer.create(socketAddress, 0) + : HttpsServer.create(socketAddress, 0); } catch (final IOException ioe) { throw new ProcessingException(LocalizationMessages.ERROR_CONTAINER_EXCEPTION_IO(), ioe); }