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 2
2
3
3
import io .quarkus .vertx .http .runtime .filters .OriginalRequestContext ;
4
4
import io .vertx .core .http .HttpMethod ;
5
- import io .vertx .core .http .HttpVersion ;
6
5
import io .vertx .ext .web .RoutingContext ;
7
6
8
7
/**
@@ -40,23 +39,7 @@ public String readAttribute(final RoutingContext exchange) {
40
39
uri = exchange .request ().uri ();
41
40
}
42
41
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 ());
60
43
}
61
44
62
45
@ Override
Original file line number Diff line number Diff line change 1
1
package io .quarkus .vertx .http .runtime .attribute ;
2
2
3
+ import io .vertx .core .http .HttpVersion ;
3
4
import io .vertx .ext .web .RoutingContext ;
4
5
5
6
/**
@@ -19,14 +20,30 @@ private RequestProtocolAttribute() {
19
20
20
21
@ Override
21
22
public String readAttribute (final RoutingContext exchange ) {
22
- return exchange .request ().version (). name ( );
23
+ return getHttpVersionStr ( exchange .request ().version ());
23
24
}
24
25
25
26
@ Override
26
27
public void writeAttribute (final RoutingContext exchange , final String newValue ) throws ReadOnlyAttributeException {
27
28
throw new ReadOnlyAttributeException ("Request getProtocol" , newValue );
28
29
}
29
30
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
+
30
47
public static final class Builder implements ExchangeAttributeBuilder {
31
48
32
49
@ Override
You can’t perform that action at this time.
0 commit comments