Make JDK 1.5 compatible

Fixes gh-71
This commit is contained in:
Rob Winch
2014-11-26 08:49:58 -06:00
parent 3254bc2bef
commit 9834e91c6d
4 changed files with 8 additions and 10 deletions

View File

@@ -8,6 +8,9 @@ apply plugin: 'propdeps-eclipse'
group = 'org.springframework.session'
sourceCompatibility = 1.5
targetCompatibility = 1.5
ext.jstlVersion = '1.2.1'
ext.servletApiVersion = '3.0.1'
ext.springSecurityVersion = '4.0.0.CI-SNAPSHOT'

View File

@@ -44,7 +44,6 @@ import com.hazelcast.core.HazelcastInstance;
public class Initializer implements ServletContextListener {
private HazelcastInstance instance;
@Override
public void contextInitialized(ServletContextEvent sce) {
String sessionMapName = "spring:session:sessions";
ServletContext sc = sce.getServletContext();
@@ -66,11 +65,10 @@ public class Initializer implements ServletContextListener {
Map<String,ExpiringSession> sessions = instance.getMap(sessionMapName);
SessionRepository<ExpiringSession> sessionRepository = new MapSessionRepository(sessions);
Dynamic fr = sc.addFilter("springSessionFilter", new SessionRepositoryFilter<>(sessionRepository ));
Dynamic fr = sc.addFilter("springSessionFilter", new SessionRepositoryFilter<ExpiringSession>(sessionRepository ));
fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
instance.shutdown();
}

View File

@@ -34,12 +34,10 @@ import org.springframework.session.web.http.HttpSessionManager;
public class UserAccountsFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@SuppressWarnings("unchecked")
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
@@ -54,7 +52,7 @@ public class UserAccountsFilter implements Filter {
String newSessionAlias = String.valueOf(System.currentTimeMillis());
String contextPath = req.getContextPath();
List<Account> accounts = new ArrayList<>();
List<Account> accounts = new ArrayList<Account>();
Account currentAccount = null;
for(Map.Entry<String, String> entry : sessionIds.entrySet()) {
String alias = entry.getKey();
@@ -88,7 +86,6 @@ public class UserAccountsFilter implements Filter {
chain.doFilter(request, response);
}
@Override
public void destroy() {
}

View File

@@ -65,7 +65,7 @@ public class WebSocketRegistryListenerTests {
@Before
public void setup() {
sessionId = "session-id";
attributes = new HashMap<>();
attributes = new HashMap<String,Object>();
SessionRepositoryMessageInterceptor.setSessionId(attributes, sessionId);
when(wsSession.getAttributes()).thenReturn(attributes);
@@ -76,7 +76,7 @@ public class WebSocketRegistryListenerTests {
when(wsSession2.getPrincipal()).thenReturn(principal);
when(wsSession2.getId()).thenReturn("wsSession-id2");
Map<String,Object> headers = new HashMap<>();
Map<String,Object> headers = new HashMap<String,Object>();
headers.put(SimpMessageHeaderAccessor.SESSION_ATTRIBUTES, attributes);
when(message.getHeaders()).thenReturn(new MessageHeaders(headers));
@@ -107,7 +107,7 @@ public class WebSocketRegistryListenerTests {
}
@Test
public void onApplicationEventConnectDisonnect() throws Exception {
public void onApplicationEventConnectDisconnect() throws Exception {
listener.onApplicationEvent(connect);
listener.onApplicationEvent(disconnect);