Java Code Examples for org.springframework.web.server.WebSession#save()

The following examples show how to use org.springframework.web.server.WebSession#save() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultWebSessionManager.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private Mono<Void> save(ServerWebExchange exchange, WebSession session) {
	List<String> ids = getSessionIdResolver().resolveSessionIds(exchange);

	if (!session.isStarted() || session.isExpired()) {
		if (!ids.isEmpty()) {
			// Expired on retrieve or while processing request, or invalidated..
			this.sessionIdResolver.expireSession(exchange);
		}
		return Mono.empty();
	}

	if (ids.isEmpty() || !session.getId().equals(ids.get(0))) {
		this.sessionIdResolver.setSessionId(exchange, session.getId());
	}

	return session.save();
}
 
Example 2
Source File: DefaultWebSessionManager.java    From java-technology-stack with MIT License 6 votes vote down vote up
private Mono<Void> save(ServerWebExchange exchange, WebSession session) {
	List<String> ids = getSessionIdResolver().resolveSessionIds(exchange);

	if (!session.isStarted() || session.isExpired()) {
		if (!ids.isEmpty()) {
			// Expired on retrieve or while processing request, or invalidated..
			this.sessionIdResolver.expireSession(exchange);
		}
		return Mono.empty();
	}

	if (ids.isEmpty() || !session.getId().equals(ids.get(0))) {
		this.sessionIdResolver.setSessionId(exchange, session.getId());
	}

	return session.save();
}