Skip to content

Commit f2f95f9

Browse files
Update JdkHttpServerFactory.java (#5163)
1 parent 47dccff commit f2f95f9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

containers/jdk-http/src/main/java/org/glassfish/jersey/jdkhttp/JdkHttpServerFactory.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -223,11 +223,15 @@ private static HttpServer createHttpServer(final URI uri,
223223
? (isHttp ? Container.DEFAULT_HTTP_PORT : Container.DEFAULT_HTTPS_PORT)
224224
: uri.getPort();
225225

226+
final InetSocketAddress socketAddress = (uri.getHost() == null)
227+
? new InetSocketAddress(port)
228+
: new InetSocketAddress(uri.getHost(), port);
229+
226230
final HttpServer server;
227231
try {
228232
server = isHttp
229-
? HttpServer.create(new InetSocketAddress(port), 0)
230-
: HttpsServer.create(new InetSocketAddress(port), 0);
233+
? HttpServer.create(socketAddress, 0)
234+
: HttpsServer.create(socketAddress, 0);
231235
} catch (final IOException ioe) {
232236
throw new ProcessingException(LocalizationMessages.ERROR_CONTAINER_EXCEPTION_IO(), ioe);
233237
}

0 commit comments

Comments
 (0)