Skip to content

Commit da5057b

Browse files
committed
log protocol
1 parent 00881c4 commit da5057b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

avaje-jex-http3-flupke/src/main/java/io/avaje/jex/http3/flupke/core/FlupkeHttpContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class FlupkeHttpContext extends HttpContext {
1515

1616
private final HttpSpiContextHandler handler;
1717
private final HttpServer server;
18-
private final Map<String, Object> attributes = new HashMap<>();
18+
private final Map<String, Object> attributes = new HashMap<>(Map.of("protocol", "UDP"));
1919
private final List<Filter> filters = new ArrayList<>();
2020
private final HttpHandler httpHandler;
2121

avaje-jex-http3-flupke/src/main/java/io/avaje/jex/http3/flupke/core/FlupkeHttpServer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.avaje.jex.http3.flupke.core;
22

3+
import static java.lang.System.Logger.Level.INFO;
4+
35
import java.io.IOException;
46
import java.net.DatagramSocket;
57
import java.net.InetSocketAddress;
@@ -16,6 +18,7 @@
1618
import com.sun.net.httpserver.HttpsConfigurator;
1719
import com.sun.net.httpserver.HttpsServer;
1820

21+
import io.avaje.applog.AppLog;
1922
import io.avaje.jex.http3.flupke.FlupkeSystemLogger;
2023
import io.avaje.jex.http3.flupke.webtransport.WebTransportEntry;
2124
import io.avaje.jex.ssl.core.SSLConfigurator;
@@ -27,6 +30,7 @@
2730

2831
class FlupkeHttpServer extends HttpsServer {
2932

33+
private static final System.Logger log = AppLog.getLogger("io.avaje.jex");
3034
private final List<WebTransportEntry> wts;
3135
private final Consumer<ServerConnector.Builder> configuration;
3236
private final Consumer<ServerConnectionConfig.Builder> connection;
@@ -133,6 +137,14 @@ public void start() {
133137
.add("Alt-Svc", "h3=\":%s\"".formatted(datagram.getLocalPort()));
134138
}));
135139
http1.start();
140+
final var serverClass = http1.getClass();
141+
142+
log.log(
143+
INFO,
144+
"Avaje Jex started {0} on TCP https://{1}:{2,number,#}",
145+
serverClass,
146+
http1.getAddress().getHostName(),
147+
http1.getAddress().getPort());
136148
}
137149

138150
@Override

avaje-jex/src/main/java/io/avaje/jex/core/BootstrapServer.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,20 @@ public static Jex.Server start(Jex jex) {
6161
server.setExecutor(config.executor());
6262
}
6363

64-
server.createContext(contextPath, handler);
64+
var protocol =
65+
server
66+
.createContext(contextPath, handler)
67+
.getAttributes()
68+
.getOrDefault("protocol", "TCP");
6569
server.start();
6670
var actualAddress = server.getAddress();
6771
jex.lifecycle().status(AppLifecycle.Status.STARTED);
6872
log.log(
6973
INFO,
70-
"Avaje Jex started {0} in {1}ms on {2}://{3}:{4,number,#}",
74+
"Avaje Jex started {0} in {1}ms on {2} {3}://{4}:{5,number,#}",
7175
serverClass,
7276
System.currentTimeMillis() - startTime,
77+
protocol,
7378
scheme,
7479
actualAddress.getHostName(),
7580
actualAddress.getPort());

0 commit comments

Comments
 (0)