Compare commits

...

5 Commits

Author SHA1 Message Date
Spring Buildmaster
b53e52f529 Release version 1.1.1.RELEASE 2016-03-16 08:15:00 -07:00
Rob Winch
debaea0b58 Update New in 1.1 Doc
Fixes gh-390
2016-03-10 10:08:59 -06:00
Rob Winch
f8707009bd Delete refactor from findbyusername doc
Fixes gh-389
2016-03-10 10:05:07 -06:00
Rob Winch
47d897c846 DefaultCookieSerializer ignores null Cookie value
Previously a null Cookie value was returned by DefaultCookieSerializer
readCookieValues(). This could cause NullPointerExeptions later on.

This commit ignores cookies with a null value.

Fixes gh-392
2016-03-04 10:23:16 -06:00
Rob Winch
09d7704c9e Fix GemFire compile in Eclipse
Fixes gh-399
2016-02-29 14:38:54 -06:00
6 changed files with 37 additions and 10 deletions

View File

@@ -6,9 +6,6 @@ This guide describes how to use Spring Session to find sessions by username.
NOTE: The completed guide can be found in the <<findbyusername-sample, findbyusername application>>.
NOTE: This feature will likely be refactored in the next release to account for https://github.com/spring-projects/spring-session/issues/301[#301]
[[findbyusername-assumptions]]
== Assumptions

View File

@@ -24,7 +24,9 @@ Additional features include:
== What's New in 1.1
Below are the highlights of what is new in Spring Session 1.1. You can find a complete list of what's new in https://github.com/spring-projects/spring-session/issues?utf8=%E2%9C%93&q=milestone%3A%221.1.0+M1%22[1.1.0 M1] and https://github.com/spring-projects/spring-session/issues?utf8=%E2%9C%93&q=milestone%3A%221.1.0+RC1%22[1.1.0 RC1] by referring to the changelog.
Below are the highlights of what is new in Spring Session 1.1. You can find a complete list of what's new in https://github.com/spring-projects/spring-session/issues?utf8=%E2%9C%93&q=milestone%3A%221.1.0+M1%22[1.1.0 M1], https://github.com/spring-projects/spring-session/issues?utf8=%E2%9C%93&q=milestone%3A%221.1.0+RC1%22[1.1.0 RC1], and
https://github.com/spring-projects/spring-session/issues?utf8=%E2%9C%93&q=milestone%3A%221.1.0%22[1.1.0]
by referring to the changelog.
* https://github.com/spring-projects/spring-session/issues/148[#148] - Added <<httpsession-gemfire,GemFire Support>>
* https://github.com/spring-projects/spring-session/issues/7[#7] - link:guides/findbyusername.html[Query by Username]
@@ -37,6 +39,7 @@ Below are the highlights of what is new in Spring Session 1.1. You can find a co
* https://github.com/spring-projects/spring-session/issues/273[#273] - Allow writing to Redis immediately (instead of lazily) using <<api-redisoperationssessionrepository-config,redisFlushMode>>
* https://github.com/spring-projects/spring-session/issues/272[#272] - Add `ExpiringSession.setLastAccessedTime(long)`
* https://github.com/spring-projects/spring-session/pull/349[#349] - Added https://gitter.im/spring-projects/spring-session[Gitter Room] for discussing Spring Session
* https://github.com/spring-projects/spring-session/issues/388[#388] - Support Spring Framework WebSockets
[[samples]]
== Samples and Guides (Start Here)

View File

@@ -3,7 +3,7 @@ jacksonVersion=2.6.5
jspApiVersion=2.0
servletApiVersion=3.0.1
jstlelVersion=1.2.5
version=1.1.1.BUILD-SNAPSHOT
version=1.1.1.RELEASE
springDataRedisVersion=1.6.2.RELEASE
junitVersion=4.12
gebVersion=0.13.1

View File

@@ -59,6 +59,9 @@ public class DefaultCookieSerializer implements CookieSerializer {
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
String sessionId = cookie.getValue();
if(sessionId == null) {
continue;
}
if(jvmRoute != null && sessionId.endsWith(jvmRoute)) {
sessionId = sessionId.substring(0, sessionId.length() - jvmRoute.length());
}

View File

@@ -299,7 +299,7 @@ public class AbstractGemFireOperationsSessionRepositoryTest {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public void afterCreatedWithNonSessionTypeDoesNotPublishSessionCreatedEvent() {
TestGemFireOperationsSessionRepository sessionRepository = new TestGemFireOperationsSessionRepository(mockGemfireOperations) {
@Override protected void handleCreated(final String sessionId, final ExpiringSession session) {
@@ -307,12 +307,12 @@ public class AbstractGemFireOperationsSessionRepositoryTest {
}
};
EntryEvent<Object, ?> mockEntryEvent = mock(EntryEvent.class);
EntryEvent mockEntryEvent = mock(EntryEvent.class);
when(mockEntryEvent.getKey()).thenReturn("abc123");
when(mockEntryEvent.getNewValue()).thenReturn(new Object());
sessionRepository.afterCreate((EntryEvent<Object, ExpiringSession>) mockEntryEvent);
sessionRepository.afterCreate(mockEntryEvent);
verify(mockEntryEvent, never()).getKey();
verify(mockEntryEvent, times(1)).getNewValue();
@@ -427,7 +427,7 @@ public class AbstractGemFireOperationsSessionRepositoryTest {
EntryEvent<Object, ?> mockEntryEvent = mock(EntryEvent.class);
when(mockEntryEvent.getKey()).thenReturn(sessionId);
when(mockEntryEvent.getOldValue()).thenReturn(new Object());
when(mockEntryEvent.getOldValue()).thenReturn(null);
sessionRepository.setApplicationEventPublisher(mockApplicationEventPublisher);
sessionRepository.afterDestroy((EntryEvent<Object, ExpiringSession>) mockEntryEvent);
@@ -548,7 +548,7 @@ public class AbstractGemFireOperationsSessionRepositoryTest {
EntryEvent<Object, ?> mockEntryEvent = mock(EntryEvent.class);
when(mockEntryEvent.getKey()).thenReturn(sessionId);
when(mockEntryEvent.getOldValue()).thenReturn(new Object());
when(mockEntryEvent.getOldValue()).thenReturn(null);
sessionRepository.setApplicationEventPublisher(mockApplicationEventPublisher);
sessionRepository.afterInvalidate((EntryEvent<Object, ExpiringSession>) mockEntryEvent);

View File

@@ -88,6 +88,30 @@ public class DefaultCookieSerializerTests {
assertThat(serializer.readCookieValues(request)).containsExactly(sessionId, secondSession);
}
// gh-392
@Test
public void readCookieValuesNullCookieValue() {
request.setCookies(new Cookie(cookieName, null));
assertThat(serializer.readCookieValues(request)).isEmpty();
}
@Test
public void readCookieValuesNullCookieValueAndJvmRoute() {
serializer.setJvmRoute("123");
request.setCookies(new Cookie(cookieName, null));
assertThat(serializer.readCookieValues(request)).isEmpty();
}
@Test
public void readCookieValuesNullCookieValueAndNotNullCookie() {
serializer.setJvmRoute("123");
request.setCookies(new Cookie(cookieName, null), new Cookie(cookieName, sessionId));
assertThat(serializer.readCookieValues(request)).containsOnly(sessionId);
}
// --- writeCookie ---
@Test