20
20
21
21
import reactor .core .publisher .Mono ;
22
22
import reactor .util .context .Context ;
23
+ import reactor .util .context .ContextView ;
23
24
24
25
import org .springframework .web .server .ServerWebExchange ;
25
26
import org .springframework .web .server .WebFilter ;
32
33
* exchange without explicitly passing it to components that participate in
33
34
* request processing.
34
35
*
35
- * <p>The convenience method {@link #get(Context )} looks up the exchange.
36
+ * <p>The convenience method {@link #getExchange(ContextView )} looks up the exchange.
36
37
*
37
38
* @author Rossen Stoyanchev
38
39
* @since 5.2
@@ -58,8 +59,22 @@ public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
58
59
* @param context the context in which to access the exchange
59
60
* @return the exchange
60
61
*/
61
- public static Optional <ServerWebExchange > get ( Context context ) {
62
+ public static Optional <ServerWebExchange > getExchange ( ContextView context ) {
62
63
return context .getOrEmpty (EXCHANGE_CONTEXT_ATTRIBUTE );
63
64
}
64
65
66
+
67
+ /**
68
+ * Access the {@link ServerWebExchange} from the Reactor Context, if available,
69
+ * which is if {@link ServerWebExchangeContextFilter} is configured for use
70
+ * and the give context was obtained from a request processing chain.
71
+ * @param context the context in which to access the exchange
72
+ * @return the exchange
73
+ * @deprecated use {@link #getExchange(ContextView)}
74
+ */
75
+ @ Deprecated (since = "6.0.6" )
76
+ public static Optional <ServerWebExchange > get (Context context ) {
77
+ return getExchange (context );
78
+ }
79
+
65
80
}
0 commit comments