17
17
18
18
import org .slf4j .Logger ;
19
19
import org .slf4j .LoggerFactory ;
20
-
21
- import org .springframework .cloud .gateway .filter .factory .WebFilterFactory ;
20
+ import org . springframework . cloud . gateway . filter . GatewayFilter ;
21
+ import org .springframework .cloud .gateway .filter .factory .GatewayFilterFactory ;
22
22
import org .springframework .context .annotation .Bean ;
23
23
import org .springframework .context .annotation .Configuration ;
24
24
import org .springframework .tuple .Tuple ;
25
- import org .springframework .web .server .WebFilter ;
26
25
import org .springframework .web .server .WebSession ;
27
26
28
27
/**
@@ -38,10 +37,10 @@ public class GatewayConfig {
38
37
/**
39
38
* Force the current WebSession to get saved
40
39
*/
41
- static class SaveSessionWebFilterFactory
42
- implements WebFilterFactory {
40
+ static class SaveSessionGatewayFilterFactory
41
+ implements GatewayFilterFactory {
43
42
@ Override
44
- public WebFilter apply (Tuple args ) {
43
+ public GatewayFilter apply (Tuple args ) {
45
44
return (exchange , chain ) -> exchange .getSession ()
46
45
.map (webSession -> {
47
46
log .debug ("Session id: " + webSession .getId ());
@@ -57,8 +56,8 @@ public WebFilter apply(Tuple args) {
57
56
}
58
57
59
58
@ Bean
60
- SaveSessionWebFilterFactory saveSessionWebFilterFactory () {
61
- return new SaveSessionWebFilterFactory ();
59
+ SaveSessionGatewayFilterFactory saveSessionWebFilterFactory () {
60
+ return new SaveSessionGatewayFilterFactory ();
62
61
}
63
62
}
64
63
// end::code[]
0 commit comments