Include alias unless single id and default alias

Fixes gh-321
This commit is contained in:
Rob Winch
2015-12-03 14:38:07 -06:00
parent 3df40dd8a9
commit b38cc74764
2 changed files with 11 additions and 2 deletions

View File

@@ -107,6 +107,14 @@ public class CookieHttpSessionStrategyTests {
assertThat(getSessionId()).isEqualTo("0 " + existing.getId() + " new " + session.getId());
}
// gh-321
@Test
public void onNewSessionExplicitAlias() throws Exception {
request.setParameter(CookieHttpSessionStrategy.DEFAULT_SESSION_ALIAS_PARAM_NAME, "new");
strategy.onNewSession(session, request, response);
assertThat(getSessionId()).isEqualTo("new " + session.getId());
}
@Test
public void onNewSessionCookiePath() throws Exception {
request.setContextPath("/somethingunique");
@@ -149,8 +157,9 @@ public class CookieHttpSessionStrategyTests {
public void onDeleteSessionExistingSessionSameAlias() throws Exception {
Session existing = new MapSession();
setSessionCookie("0 " + existing.getId() + " new " + session.getId());
request.setParameter(CookieHttpSessionStrategy.DEFAULT_SESSION_ALIAS_PARAM_NAME, "new");
strategy.onInvalidateSession(request, response);
assertThat(getSessionId()).isEqualTo(session.getId());
assertThat(getSessionId()).isEqualTo(existing.getId());
}
@Test