File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
reactor-netty-examples/src/main/java/reactor/netty/examples/http Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
2+ * Copyright (c) 2020-2023 VMware, Inc. or its affiliates, All Rights Reserved.
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.
1717
1818import io .netty .handler .ssl .util .SelfSignedCertificate ;
1919import reactor .netty .http .Http11SslContextSpec ;
20+ import reactor .netty .http .Http2SslContextSpec ;
2021import reactor .netty .http .HttpProtocol ;
2122import reactor .netty .http .server .HttpServer ;
2223
@@ -48,8 +49,12 @@ public static void main(String[] args) throws Exception {
4849
4950 if (SECURE ) {
5051 SelfSignedCertificate ssc = new SelfSignedCertificate ();
51- server = server .secure (
52- spec -> spec .sslContext (Http11SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
52+ if (HTTP2 ) {
53+ server = server .secure (spec -> spec .sslContext (Http2SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
54+ }
55+ else {
56+ server = server .secure (spec -> spec .sslContext (Http11SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
57+ }
5358 }
5459
5560 if (HTTP2 ) {
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
2+ * Copyright (c) 2020-2023 VMware, Inc. or its affiliates, All Rights Reserved.
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.
1818import io .netty .handler .ssl .util .SelfSignedCertificate ;
1919import reactor .core .publisher .Mono ;
2020import reactor .netty .http .Http11SslContextSpec ;
21+ import reactor .netty .http .Http2SslContextSpec ;
2122import reactor .netty .http .HttpProtocol ;
2223import reactor .netty .http .server .HttpServer ;
2324
@@ -49,8 +50,12 @@ public static void main(String[] args) throws Exception {
4950
5051 if (SECURE ) {
5152 SelfSignedCertificate ssc = new SelfSignedCertificate ();
52- server = server .secure (
53- spec -> spec .sslContext (Http11SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
53+ if (HTTP2 ) {
54+ server = server .secure (spec -> spec .sslContext (Http2SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
55+ }
56+ else {
57+ server = server .secure (spec -> spec .sslContext (Http11SslContextSpec .forServer (ssc .certificate (), ssc .privateKey ())));
58+ }
5459 }
5560
5661 if (HTTP2 ) {
You can’t perform that action at this time.
0 commit comments