001/* 002 * Copyright 2002-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.server.session; 018 019import java.util.List; 020 021import org.springframework.web.server.ServerWebExchange; 022 023/** 024 * Contract for session id resolution strategies. Allows for session id 025 * resolution through the request and for sending the session id or expiring 026 * the session through the response. 027 * 028 * @author Rossen Stoyanchev 029 * @since 5.0 030 * @see CookieWebSessionIdResolver 031 */ 032public interface WebSessionIdResolver { 033 034 /** 035 * Resolve the session id's associated with the request. 036 * @param exchange the current exchange 037 * @return the session id's or an empty list 038 */ 039 List<String> resolveSessionIds(ServerWebExchange exchange); 040 041 /** 042 * Send the given session id to the client. 043 * @param exchange the current exchange 044 * @param sessionId the session id 045 */ 046 void setSessionId(ServerWebExchange exchange, String sessionId); 047 048 /** 049 * Instruct the client to end the current session. 050 * @param exchange the current exchange 051 */ 052 void expireSession(ServerWebExchange exchange); 053 054}