Skip to content

Commit

Permalink
Fix chapter 10's Spring Cloud Gateway configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gregturn committed Oct 19, 2017
1 parent cd1f050 commit 9e1ff4e
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.cloud.gateway.filter.factory.WebFilterFactory;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.GatewayFilterFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.tuple.Tuple;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebSession;

/**
Expand All @@ -38,10 +37,10 @@ public class GatewayConfig {
/**
* Force the current WebSession to get saved
*/
static class SaveSessionWebFilterFactory
implements WebFilterFactory {
static class SaveSessionGatewayFilterFactory
implements GatewayFilterFactory {
@Override
public WebFilter apply(Tuple args) {
public GatewayFilter apply(Tuple args) {
return (exchange, chain) -> exchange.getSession()
.map(webSession -> {
log.debug("Session id: " + webSession.getId());
Expand All @@ -57,8 +56,8 @@ public WebFilter apply(Tuple args) {
}

@Bean
SaveSessionWebFilterFactory saveSessionWebFilterFactory() {
return new SaveSessionWebFilterFactory();
SaveSessionGatewayFilterFactory saveSessionWebFilterFactory() {
return new SaveSessionGatewayFilterFactory();
}
}
// end::code[]

0 comments on commit 9e1ff4e

Please sign in to comment.