从请求中计算 Union Session Id 的工具类
| Modifiers | Name | Description |
|---|---|---|
protected static org.apache.commons.logging.Log |
log |
| Type | Name and description |
|---|---|
protected String |
getRequestedSessionIdFromHeader(javax.servlet.http.HttpServletRequest request) |
protected String |
getRequestedSessionIdFromURL(javax.servlet.http.HttpServletRequest request) |
String |
getUnionSessionId(javax.servlet.http.HttpServletRequest request)从请求中计算 session id |
| Methods inherited from class | Name |
|---|---|
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
从请求中计算 session id
定义成名为 unionHttpSessionReader 的 bean,所有请求都会通过该 bean 获取当前的 session id;有两种调用方式:
1、未启用 SpringSession 的情况,在 UnionHttpSessionRequestWrapper 中调用;
2、启用 SpringSession 的情况,在 UnionHttpSessionStrategy 中调用。
计算顺序:Url Rewrite、header。
由于上面的调用处都会自动处理 cookie,因此这里不从 cookie 中计算。
如果要自定义 bean,从其他地方计算 session id、或者对 id 进行解密计算, 可以创建一个新的类、并且继承本类、实现方法 getUnionSessionId、注册成同名 bean 即可。
request - Http 请求