RedisSessionRepository implements SessionRepository { static String extractSessionId(String body) { int beginIndex = body.lastIndexOf(':') + 1; String sessionId = body.substring(beginIndex); int braceOpening = sessionId.indexOf('{'); if (braceOpening >= 0) { int braceClosing = sessionId.indexOf('}', braceOpening + 1); if (braceClosing > braceOpening) { int idLen = sessionId.length(); StringBuilder sb = new StringBuilder(idLen - 2); if (braceOpening > 0) { sb.append(sessionId, 0, braceOpening); } sb.append(sessionId, braceOpening + 1, braceClosing).append(sessionId, braceClosing + 1, idLen); sessionId = sb.toString(); } } return sessionId; } RedisSessionRepository(RedisFacade redis, String namespace, String owner, ExpirationStrategy strategy,
      boolean sticky); @Override void setSessionManager(final SessionManager sessionManager); @Override SessionData getSessionData(String id); @Override CommitTransaction startCommit(SessionData session); @Override void remove(SessionData session); byte[] sessionKey(String sessionId); @Override Object getSessionAttribute(SessionData session, String attribute); @Override boolean prepareRemove(SessionData session); @Override Set<String> getAllKeys(SessionData session); @Override void storeSessionData(SessionData sessionData); @Override void requestFinished(); @Override void setSessionAttribute(SessionData session, String name, Object value); @Override void removeSessionAttribute(SessionData session, String name); @Override boolean cleanSessionsOnShutdown(); @Override Collection<String> getOwnedSessionIds(); @Override void close(); @Override void reset(); @Override void sessionIdChange(SessionData sessionData); @Override boolean isConnected();  }
@Test public void testExtractSessionId() { assertEquals("", RedisSessionRepository.extractSessionId("")); assertEquals("123123", RedisSessionRepository.extractSessionId("123123")); assertEquals("123123", RedisSessionRepository.extractSessionId("abc:123123")); assertEquals("123123", RedisSessionRepository.extractSessionId("abc:{123123}")); assertEquals("0123123", RedisSessionRepository.extractSessionId("abc:0{123123}")); assertEquals("0123123", RedisSessionRepository.extractSessionId("abc:def:0{123123}")); assertEquals("{123123", RedisSessionRepository.extractSessionId("abc:{123123")); }