static field for constant in SessionRepositoryFilter

Fixes gh-654
This commit is contained in:
Alex Panchenko
2016-10-28 20:18:57 +07:00
committed by Rob Winch
parent 466e2cf102
commit 1c9dfa6638

View File

@@ -93,6 +93,8 @@ public class SessionRepositoryFilter<S extends ExpiringSession>
public static final String INVALID_SESSION_ID_ATTR = SESSION_REPOSITORY_ATTR
+ ".invalidSessionId";
private static final String CURRENT_SESSION_ATTR = "org.springframework.session.web.http.CURRENT_SESSION"; // compile-time constant.
/**
* The default filter order.
*/
@@ -213,8 +215,6 @@ public class SessionRepositoryFilter<S extends ExpiringSession>
*/
private final class SessionRepositoryRequestWrapper
extends HttpServletRequestWrapper {
private final String CURRENT_SESSION_ATTR = HttpServletRequestWrapper.class
.getName();
private Boolean requestedSessionIdValid;
private boolean requestedSessionInvalidated;
private final HttpServletResponse response;
@@ -252,15 +252,15 @@ public class SessionRepositoryFilter<S extends ExpiringSession>
@SuppressWarnings("unchecked")
private HttpSessionWrapper getCurrentSession() {
return (HttpSessionWrapper) getAttribute(this.CURRENT_SESSION_ATTR);
return (HttpSessionWrapper) getAttribute(CURRENT_SESSION_ATTR);
}
private void setCurrentSession(HttpSessionWrapper currentSession) {
if (currentSession == null) {
removeAttribute(this.CURRENT_SESSION_ATTR);
removeAttribute(CURRENT_SESSION_ATTR);
}
else {
setAttribute(this.CURRENT_SESSION_ATTR, currentSession);
setAttribute(CURRENT_SESSION_ATTR, currentSession);
}
}