Skip to content

Commit 0292d9b

Browse files
authored
Adds afterStart(WebServer) implementations to various delegating ServerLifecycle implementations that were missing it (helidon-io#9820)
Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
1 parent f2e2f5e commit 0292d9b

7 files changed

Lines changed: 51 additions & 7 deletions

File tree

webserver/webserver/src/main/java/io/helidon/webserver/ServerFeatureContextImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -324,6 +324,11 @@ public void beforeStart() {
324324
delegate.get().beforeStart();
325325
}
326326

327+
@Override
328+
public void afterStart(WebServer webServer) {
329+
delegate.get().afterStart(webServer);
330+
}
331+
327332
@Override
328333
public void afterStop() {
329334
delegate.get().afterStop();

webserver/webserver/src/main/java/io/helidon/webserver/http/Filters.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
import io.helidon.http.Status;
2828
import io.helidon.webserver.ConnectionContext;
2929
import io.helidon.webserver.ServerLifecycle;
30+
import io.helidon.webserver.WebServer;
3031

3132
/**
3233
* Handler of HTTP filters.
@@ -58,6 +59,11 @@ public void beforeStart() {
5859
filters.forEach(Filter::beforeStart);
5960
}
6061

62+
@Override
63+
public void afterStart(WebServer webServer) {
64+
filters.forEach(f -> f.afterStart(webServer));
65+
}
66+
6167
@Override
6268
public void afterStop() {
6369
filters.forEach(Filter::afterStop);

webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
2222
import io.helidon.http.Method;
2323
import io.helidon.http.PathMatcher;
2424
import io.helidon.http.PathMatchers;
25+
import io.helidon.webserver.WebServer;
2526

2627
class HttpRouteImpl extends HttpRouteBase implements HttpRoute {
2728
private final Handler handler;
@@ -53,6 +54,11 @@ public void beforeStart() {
5354
handler.beforeStart();
5455
}
5556

57+
@Override
58+
public void afterStart(WebServer webServer) {
59+
handler.afterStart(webServer);
60+
}
61+
5662
@Override
5763
public void afterStop() {
5864
handler.afterStop();

webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRouteWrap.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818

1919
import io.helidon.http.HttpPrologue;
2020
import io.helidon.http.PathMatchers;
21+
import io.helidon.webserver.WebServer;
2122

2223
class HttpRouteWrap extends HttpRouteBase {
2324
private final HttpRoute route;
@@ -31,6 +32,11 @@ public void beforeStart() {
3132
route.beforeStart();
3233
}
3334

35+
@Override
36+
public void afterStart(WebServer webServer) {
37+
route.afterStart(webServer);
38+
}
39+
3440
@Override
3541
public void afterStop() {
3642
route.afterStop();

webserver/webserver/src/main/java/io/helidon/webserver/http/HttpRoutingImpl.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
import io.helidon.http.Status;
3333
import io.helidon.webserver.ConnectionContext;
3434
import io.helidon.webserver.ServerLifecycle;
35+
import io.helidon.webserver.WebServer;
3536

3637
final class HttpRoutingImpl implements HttpRouting {
3738
private static final System.Logger LOGGER = System.getLogger(HttpRoutingImpl.class.getName());
@@ -80,6 +81,13 @@ public void beforeStart() {
8081
features.forEach(ServerLifecycle::beforeStart);
8182
}
8283

84+
@Override
85+
public void afterStart(WebServer webServer) {
86+
filters.afterStart(webServer);
87+
rootRoute.afterStart(webServer);
88+
features.forEach(f -> f.afterStart(webServer));
89+
}
90+
8391
@Override
8492
public void afterStop() {
8593
filters.afterStop();

webserver/webserver/src/main/java/io/helidon/webserver/http/ServiceRoute.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
import io.helidon.http.PathMatcher;
2525
import io.helidon.http.PathMatchers;
2626
import io.helidon.webserver.ConnectionContext;
27+
import io.helidon.webserver.WebServer;
2728

2829
class ServiceRoute extends HttpRouteBase implements HttpRoute {
2930
private final HttpService theService;
@@ -47,6 +48,12 @@ public void beforeStart() {
4748
this.routes.forEach(HttpRouteBase::beforeStart);
4849
}
4950

51+
@Override
52+
public void afterStart(WebServer webServer) {
53+
theService.afterStart(webServer);
54+
this.routes.forEach(r -> r.afterStart(webServer));
55+
}
56+
5057
@Override
5158
public void afterStop() {
5259
theService.afterStop();

webserver/webserver/src/main/java/io/helidon/webserver/http1/Http1Route.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
2222
import io.helidon.http.Method;
2323
import io.helidon.http.PathMatcher;
2424
import io.helidon.http.PathMatchers;
25+
import io.helidon.webserver.WebServer;
2526
import io.helidon.webserver.http.Handler;
2627
import io.helidon.webserver.http.HttpRoute;
2728

@@ -76,6 +77,11 @@ public void beforeStart() {
7677
handler.beforeStart();
7778
}
7879

80+
@Override
81+
public void afterStart(WebServer webServer) {
82+
handler.afterStart(webServer);
83+
}
84+
7985
@Override
8086
public void afterStop() {
8187
handler.afterStop();

0 commit comments

Comments
 (0)