File tree Expand file tree Collapse file tree 2 files changed +19
-19
lines changed
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute Expand file tree Collapse file tree 2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change 22
33import io .quarkus .vertx .http .runtime .filters .OriginalRequestContext ;
44import io .vertx .core .http .HttpMethod ;
5- import io .vertx .core .http .HttpVersion ;
65import io .vertx .ext .web .RoutingContext ;
76
87/**
@@ -40,23 +39,7 @@ public String readAttribute(final RoutingContext exchange) {
4039 uri = exchange .request ().uri ();
4140 }
4241
43- return httpMethod + " " + uri + " " + getHttpVersionStr (exchange .request ().version ());
44- }
45-
46- private static String getHttpVersionStr (HttpVersion version ) {
47- // best effort to try and infer the HTTP version from
48- // any "unknown" enum value
49- return switch (version ) {
50- case HTTP_1_0 -> "HTTP/1.0" ;
51- case HTTP_1_1 -> "HTTP/1.1" ;
52- case HTTP_2 -> "HTTP/2" ;
53- default ->
54- // best effort to try and infer the HTTP version from
55- // any "unknown" enum value
56- version .name ()
57- .replace ("HTTP_" , "HTTP/" )
58- .replace ("_" , "." );
59- };
42+ return httpMethod + " " + uri + " " + RequestProtocolAttribute .getHttpVersionStr (exchange .request ().version ());
6043 }
6144
6245 @ Override
Original file line number Diff line number Diff line change 11package io .quarkus .vertx .http .runtime .attribute ;
22
3+ import io .vertx .core .http .HttpVersion ;
34import io .vertx .ext .web .RoutingContext ;
45
56/**
@@ -19,14 +20,30 @@ private RequestProtocolAttribute() {
1920
2021 @ Override
2122 public String readAttribute (final RoutingContext exchange ) {
22- return exchange .request ().version (). name ( );
23+ return getHttpVersionStr ( exchange .request ().version ());
2324 }
2425
2526 @ Override
2627 public void writeAttribute (final RoutingContext exchange , final String newValue ) throws ReadOnlyAttributeException {
2728 throw new ReadOnlyAttributeException ("Request getProtocol" , newValue );
2829 }
2930
31+ static String getHttpVersionStr (HttpVersion version ) {
32+ // best effort to try and infer the HTTP version from
33+ // any "unknown" enum value
34+ return switch (version ) {
35+ case HTTP_1_0 -> "HTTP/1.0" ;
36+ case HTTP_1_1 -> "HTTP/1.1" ;
37+ case HTTP_2 -> "HTTP/2" ;
38+ default ->
39+ // best effort to try and infer the HTTP version from
40+ // any "unknown" enum value
41+ version .name ()
42+ .replace ("HTTP_" , "HTTP/" )
43+ .replace ("_" , "." );
44+ };
45+ }
46+
3047 public static final class Builder implements ExchangeAttributeBuilder {
3148
3249 @ Override
You can’t perform that action at this time.
0 commit comments