From 1c9dfa663851673404eacda8ce99773d33ea1113 Mon Sep 17 00:00:00 2001 From: Alex Panchenko Date: Fri, 28 Oct 2016 20:18:57 +0700 Subject: [PATCH] static field for constant in SessionRepositoryFilter Fixes gh-654 --- .../session/web/http/SessionRepositoryFilter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-session/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java b/spring-session/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java index ce47ec0c..a6427b25 100644 --- a/spring-session/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java +++ b/spring-session/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java @@ -93,6 +93,8 @@ public class SessionRepositoryFilter 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 */ 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 @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); } }