Example usage for org.springframework.web.server ServerWebExchange getSession

List of usage examples for org.springframework.web.server ServerWebExchange getSession

Introduction

In this page you can find the example usage for org.springframework.web.server ServerWebExchange getSession.

Prototype

Mono<WebSession> getSession();

Source Link

Document

Return the web session for the current request.

Usage

From source file:org.springframework.security.web.server.savedrequest.WebSessionServerRequestCache.java

@Override
public Mono<Void> saveRequest(ServerWebExchange exchange) {
    return this.saveRequestMatcher.matches(exchange).filter(m -> m.isMatch())
            .flatMap(m -> exchange.getSession()).map(WebSession::getAttributes)
            .doOnNext(attrs -> attrs.put(this.sessionAttrName, pathInApplication(exchange.getRequest())))
            .then();//from w ww . jav  a2s . c  om
}

From source file:org.springframework.security.web.server.savedrequest.WebSessionServerRequestCache.java

@Override
public Mono<URI> getRedirectUri(ServerWebExchange exchange) {
    return exchange.getSession()
            .flatMap(session -> Mono.justOrEmpty(session.<String>getAttribute(this.sessionAttrName)))
            .map(URI::create);/* www . j  a va  2s  .  co m*/
}

From source file:org.springframework.security.web.server.savedrequest.WebSessionServerRequestCache.java

@Override
public Mono<ServerHttpRequest> removeMatchingRequest(ServerWebExchange exchange) {
    return exchange.getSession().map(WebSession::getAttributes).filter(
            attributes -> attributes.remove(this.sessionAttrName, pathInApplication(exchange.getRequest())))
            .map(attributes -> exchange.getRequest());
}