Make Servlet 2.5 compatible
Fixes gh-111 gh-182
This commit is contained in:
@@ -24,9 +24,11 @@ import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@WebAppConfiguration
|
||||
public class RedisHttpSessionConfigurationXmlCustomExpireTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,9 +24,11 @@ import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@WebAppConfiguration
|
||||
public class RedisHttpSessionConfigurationXmlTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.springframework.core.annotation.OrderUtils;
|
||||
import org.springframework.mock.web.MockFilterChain;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.session.ExpiringSession;
|
||||
import org.springframework.session.MapSessionRepository;
|
||||
import org.springframework.session.Session;
|
||||
@@ -188,6 +189,22 @@ public class SessionRepositoryFilterTests<S extends ExpiringSession> {
|
||||
});
|
||||
}
|
||||
|
||||
// gh-111
|
||||
@Test
|
||||
public void doFilterServletContextExplicit() throws Exception {
|
||||
final ServletContext expectedContext = new MockServletContext();
|
||||
filter = new SessionRepositoryFilter<ExpiringSession>(sessionRepository);
|
||||
filter.setServletContext(expectedContext);
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest) {
|
||||
ServletContext context = wrappedRequest.getSession().getServletContext();
|
||||
assertThat(context).isSameAs(expectedContext);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doFilterMaxInactiveIntervalDefault() throws Exception {
|
||||
doFilter(new DoInFilter() {
|
||||
|
||||
Reference in New Issue
Block a user