public class BroadleafCookieHttpSessionStrategy extends Object implements HttpSessionManager, MultiHttpSessionStrategy, org.springframework.session.web.http.HttpSessionIdResolver
SessionRepositoryFilter
.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ALIAS |
static String |
DEFAULT_SESSION_ALIAS_PARAM_NAME |
Constructor and Description |
---|
BroadleafCookieHttpSessionStrategy() |
Modifier and Type | Method and Description |
---|---|
String |
encodeURL(String url,
String sessionAlias)
Provides the ability to encode the URL for a given session alias.
|
void |
expireSession(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
String |
getCurrentSessionAlias(javax.servlet.http.HttpServletRequest request)
Gets the current session's alias from the
HttpServletRequest . |
String |
getNewSessionAlias(javax.servlet.http.HttpServletRequest request)
Gets a new and unique Session alias.
|
String |
getRequestedSessionId(javax.servlet.http.HttpServletRequest request) |
Map<String,String> |
getSessionIds(javax.servlet.http.HttpServletRequest request)
Gets a mapping of the session alias to the session id from the
HttpServletRequest . |
List<String> |
resolveSessionIds(javax.servlet.http.HttpServletRequest request) |
void |
setCookieSerializer(org.springframework.session.web.http.CookieSerializer cookieSerializer)
Sets the
CookieSerializer to be used. |
void |
setDeserializationDelimiter(String delimiter)
Sets the delimiter between a session alias and a session id when deserializing a
cookie.
|
void |
setSerializationDelimiter(String delimiter)
Sets the delimiter between a session alias and a session id when deserializing a
cookie.
|
void |
setSessionId(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String sessionId) |
javax.servlet.http.HttpServletRequest |
wrapRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Allows customizing the
HttpServletRequest . |
javax.servlet.http.HttpServletResponse |
wrapResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Allows customizing the
HttpServletResponse . |
public static final String DEFAULT_ALIAS
public static final String DEFAULT_SESSION_ALIAS_PARAM_NAME
public List<String> resolveSessionIds(javax.servlet.http.HttpServletRequest request)
resolveSessionIds
in interface org.springframework.session.web.http.HttpSessionIdResolver
public String getCurrentSessionAlias(javax.servlet.http.HttpServletRequest request)
HttpSessionManager
HttpServletRequest
.getCurrentSessionAlias
in interface HttpSessionManager
request
- the HttpServletRequest
to obtain the current session's alias
from.public Map<String,String> getSessionIds(javax.servlet.http.HttpServletRequest request)
HttpSessionManager
HttpServletRequest
.getSessionIds
in interface HttpSessionManager
request
- the HttpServletRequest
to obtain the mapping from. Cannot be
null.HttpServletRequest
. Cannot be null.public String getRequestedSessionId(javax.servlet.http.HttpServletRequest request)
public String getNewSessionAlias(javax.servlet.http.HttpServletRequest request)
HttpSessionManager
HttpSessionManager#encodeURL(java.lang.String)
. For example:
String newAlias = httpSessionManager.getNewSessionAlias(request);
String addAccountUrl = httpSessionManager.encodeURL("./", newAlias);
getNewSessionAlias
in interface HttpSessionManager
request
- the HttpServletRequest
to get a new alias frompublic javax.servlet.http.HttpServletRequest wrapRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
MultiHttpSessionStrategy
HttpServletRequest
.wrapRequest
in interface MultiHttpSessionStrategy
request
- the original HttpServletRequest
. Cannot be null.response
- the original HttpServletResponse
. This is NOT the result of
MultiHttpSessionStrategy.wrapResponse(HttpServletRequest, HttpServletResponse)
Cannot be null. .HttpServletRequest
public javax.servlet.http.HttpServletResponse wrapResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
MultiHttpSessionStrategy
HttpServletResponse
.wrapResponse
in interface MultiHttpSessionStrategy
request
- the original HttpServletRequest
. This is NOT the result of
MultiHttpSessionStrategy.wrapRequest(HttpServletRequest, HttpServletResponse)
. Cannot be null.response
- the original HttpServletResponse
. Cannot be null.HttpServletResponse
public String encodeURL(String url, String sessionAlias)
HttpSessionManager
encodeURL
in interface HttpSessionManager
url
- the url to encode.sessionAlias
- the session alias to encode.public void setDeserializationDelimiter(String delimiter)
delimiter
- the delimiter to set (i.e. "_ " will try a delimeter of either "_"
or " ")public void setSerializationDelimiter(String delimiter)
delimiter
- the delimiter to set (i.e. "_")public void setCookieSerializer(org.springframework.session.web.http.CookieSerializer cookieSerializer)
CookieSerializer
to be used.cookieSerializer
- the cookieSerializer to set. Cannot be null.public void setSessionId(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String sessionId)
setSessionId
in interface org.springframework.session.web.http.HttpSessionIdResolver
public void expireSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
expireSession
in interface org.springframework.session.web.http.HttpSessionIdResolver
Copyright © 2021. All rights reserved.