Remove unnecessary throws declaration
This commit is contained in:
@@ -23,7 +23,6 @@ import javax.servlet.DispatcherType;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterRegistration.Dynamic;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.Conventions;
|
||||
@@ -105,7 +104,7 @@ public abstract class AbstractHttpSessionApplicationInitializer implements WebAp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartup(ServletContext servletContext) throws ServletException {
|
||||
public void onStartup(ServletContext servletContext) {
|
||||
beforeSessionRepositoryFilter(servletContext);
|
||||
if (this.configurationClasses != null) {
|
||||
AnnotationConfigWebApplicationContext rootAppContext = new AnnotationConfigWebApplicationContext();
|
||||
|
||||
@@ -125,7 +125,7 @@ public final class SessionRepositoryMessageInterceptor<S extends Session>
|
||||
|
||||
@Override
|
||||
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
|
||||
Map<String, Object> attributes) throws Exception {
|
||||
Map<String, Object> attributes) {
|
||||
if (request instanceof ServletServerHttpRequest) {
|
||||
ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request;
|
||||
HttpSession session = servletRequest.getServletRequest().getSession(false);
|
||||
|
||||
@@ -47,7 +47,7 @@ class CookieHttpSessionIdResolverTests {
|
||||
private Session session;
|
||||
|
||||
@BeforeEach
|
||||
void setup() throws Exception {
|
||||
void setup() {
|
||||
this.cookieName = "SESSION";
|
||||
this.session = new MapSession();
|
||||
this.request = new MockHttpServletRequest();
|
||||
@@ -56,19 +56,19 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRequestedSessionIdNull() throws Exception {
|
||||
void getRequestedSessionIdNull() {
|
||||
assertThat(this.strategy.resolveSessionIds(this.request)).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRequestedSessionIdNotNull() throws Exception {
|
||||
void getRequestedSessionIdNotNull() {
|
||||
setSessionCookie(this.session.getId());
|
||||
assertThat(this.strategy.resolveSessionIds(this.request))
|
||||
.isEqualTo(Collections.singletonList(this.session.getId()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRequestedSessionIdNotNullCustomCookieName() throws Exception {
|
||||
void getRequestedSessionIdNotNullCustomCookieName() {
|
||||
setCookieName("CUSTOM");
|
||||
setSessionCookie(this.session.getId());
|
||||
assertThat(this.strategy.resolveSessionIds(this.request))
|
||||
@@ -76,13 +76,13 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onNewSession() throws Exception {
|
||||
void onNewSession() {
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
assertThat(getSessionId()).isEqualTo(this.session.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void onNewSessionTwiceSameId() throws Exception {
|
||||
void onNewSessionTwiceSameId() {
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
|
||||
@@ -90,7 +90,7 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onNewSessionTwiceNewId() throws Exception {
|
||||
void onNewSessionTwiceNewId() {
|
||||
Session newSession = new MapSession();
|
||||
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
@@ -104,7 +104,7 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onNewSessionCookiePath() throws Exception {
|
||||
void onNewSessionCookiePath() {
|
||||
this.request.setContextPath("/somethingunique");
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
|
||||
@@ -113,20 +113,20 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onNewSessionCustomCookieName() throws Exception {
|
||||
void onNewSessionCustomCookieName() {
|
||||
setCookieName("CUSTOM");
|
||||
this.strategy.setSessionId(this.request, this.response, this.session.getId());
|
||||
assertThat(getSessionId()).isEqualTo(this.session.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void onDeleteSession() throws Exception {
|
||||
void onDeleteSession() {
|
||||
this.strategy.expireSession(this.request, this.response);
|
||||
assertThat(getSessionId()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void onDeleteSessionCookiePath() throws Exception {
|
||||
void onDeleteSessionCookiePath() {
|
||||
this.request.setContextPath("/somethingunique");
|
||||
this.strategy.expireSession(this.request, this.response);
|
||||
|
||||
@@ -135,7 +135,7 @@ class CookieHttpSessionIdResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onDeleteSessionCustomCookieName() throws Exception {
|
||||
void onDeleteSessionCustomCookieName() {
|
||||
setCookieName("CUSTOM");
|
||||
this.strategy.expireSession(this.request, this.response);
|
||||
assertThat(getSessionId()).isEmpty();
|
||||
|
||||
@@ -1061,7 +1061,7 @@ class OnCommittedResponseWrapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void contentLengthDoesNotCommit() throws IOException {
|
||||
void contentLengthDoesNotCommit() {
|
||||
String body = "something";
|
||||
|
||||
this.response.setContentLength(body.length());
|
||||
|
||||
@@ -96,7 +96,7 @@ class SessionRepositoryFilterTests {
|
||||
private MockFilterChain chain;
|
||||
|
||||
@BeforeEach
|
||||
void setup() throws Exception {
|
||||
void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
this.sessions = new HashMap<>();
|
||||
this.sessionRepository = new MapSessionRepository(this.sessions);
|
||||
@@ -1141,8 +1141,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
String actualId = wrappedRequest.getRequestedSessionId();
|
||||
assertThat(actualId).isEqualTo(expectedId);
|
||||
}
|
||||
@@ -1176,8 +1175,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
wrappedRequest.getSession();
|
||||
}
|
||||
});
|
||||
@@ -1194,8 +1192,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
wrappedRequest.getSession().getId();
|
||||
}
|
||||
});
|
||||
@@ -1207,8 +1204,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
wrappedRequest.getSession().invalidate();
|
||||
}
|
||||
});
|
||||
@@ -1223,8 +1219,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
wrappedRequest.getSession().getId();
|
||||
}
|
||||
});
|
||||
@@ -1235,8 +1230,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1252,8 +1246,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
wrappedRequest.getSession().getId();
|
||||
}
|
||||
});
|
||||
@@ -1263,8 +1256,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1279,8 +1271,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1298,8 +1289,7 @@ class SessionRepositoryFilterTests {
|
||||
|
||||
doFilter(new DoInFilter() {
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse)
|
||||
throws IOException {
|
||||
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1505,7 +1495,7 @@ class SessionRepositoryFilterTests {
|
||||
this.chain = new MockFilterChain();
|
||||
}
|
||||
|
||||
private void nextRequest() throws Exception {
|
||||
private void nextRequest() {
|
||||
Map<String, Cookie> nameToCookie = new HashMap<>();
|
||||
if (this.request.getCookies() != null) {
|
||||
for (Cookie cookie : this.request.getCookies()) {
|
||||
|
||||
@@ -154,7 +154,7 @@ class WebSocketRegistryListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onApplicationEventConnectDisconnectNullSession() throws Exception {
|
||||
void onApplicationEventConnectDisconnectNullSession() {
|
||||
this.listener.onApplicationEvent(this.connect);
|
||||
this.attributes.clear();
|
||||
|
||||
|
||||
@@ -222,14 +222,14 @@ class SessionRepositoryMessageInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void beforeHandshakeNotServletServerHttpRequest() throws Exception {
|
||||
void beforeHandshakeNotServletServerHttpRequest() {
|
||||
assertThat(this.interceptor.beforeHandshake(null, null, null, null)).isTrue();
|
||||
|
||||
verifyZeroInteractions(this.sessionRepository);
|
||||
}
|
||||
|
||||
@Test
|
||||
void beforeHandshakeNullSession() throws Exception {
|
||||
void beforeHandshakeNullSession() {
|
||||
ServletServerHttpRequest request = new ServletServerHttpRequest(new MockHttpServletRequest());
|
||||
assertThat(this.interceptor.beforeHandshake(request, null, null, null)).isTrue();
|
||||
|
||||
@@ -237,7 +237,7 @@ class SessionRepositoryMessageInterceptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void beforeHandshakeSession() throws Exception {
|
||||
void beforeHandshakeSession() {
|
||||
MockHttpServletRequest httpRequest = new MockHttpServletRequest();
|
||||
HttpSession httpSession = httpRequest.getSession();
|
||||
ServletServerHttpRequest request = new ServletServerHttpRequest(httpRequest);
|
||||
|
||||
@@ -47,7 +47,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
|
||||
private ReactiveRedisOperationsSessionRepository repository;
|
||||
|
||||
@Test
|
||||
void saves() throws InterruptedException {
|
||||
void saves() {
|
||||
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
|
||||
|
||||
String expectedAttributeName = "a";
|
||||
@@ -100,7 +100,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenOnlyChangeId() throws Exception {
|
||||
void changeSessionIdWhenOnlyChangeId() {
|
||||
String attrName = "changeSessionId";
|
||||
String attrValue = "changeSessionId-value";
|
||||
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
|
||||
@@ -127,7 +127,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenChangeTwice() throws Exception {
|
||||
void changeSessionIdWhenChangeTwice() {
|
||||
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
|
||||
|
||||
this.repository.save(toSave).block();
|
||||
@@ -144,7 +144,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenSetAttributeOnChangedSession() throws Exception {
|
||||
void changeSessionIdWhenSetAttributeOnChangedSession() {
|
||||
String attrName = "changeSessionId";
|
||||
String attrValue = "changeSessionId-value";
|
||||
|
||||
@@ -171,7 +171,7 @@ class ReactiveRedisOperationsSessionRepositoryITests extends AbstractRedisITests
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenHasNotSaved() throws Exception {
|
||||
void changeSessionIdWhenHasNotSaved() {
|
||||
ReactiveRedisOperationsSessionRepository.RedisSession toSave = this.repository.createSession().block();
|
||||
String originalId = toSave.getId();
|
||||
toSave.changeSessionId();
|
||||
|
||||
@@ -173,7 +173,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByPrincipalNameExpireRemovesIndex() throws Exception {
|
||||
void findByPrincipalNameExpireRemovesIndex() {
|
||||
String principalName = "findByPrincipalNameExpireRemovesIndex" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
@@ -195,7 +195,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByPrincipalNameNoPrincipalNameChange() throws Exception {
|
||||
void findByPrincipalNameNoPrincipalNameChange() {
|
||||
String principalName = "findByPrincipalNameNoPrincipalNameChange" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
@@ -213,7 +213,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByPrincipalNameNoPrincipalNameChangeReload() throws Exception {
|
||||
void findByPrincipalNameNoPrincipalNameChangeReload() {
|
||||
String principalName = "findByPrincipalNameNoPrincipalNameChangeReload" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
@@ -233,7 +233,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByDeletedPrincipalName() throws Exception {
|
||||
void findByDeletedPrincipalName() {
|
||||
String principalName = "findByDeletedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
@@ -250,7 +250,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByChangedPrincipalName() throws Exception {
|
||||
void findByChangedPrincipalName() {
|
||||
String principalName = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
@@ -272,7 +272,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByDeletedPrincipalNameReload() throws Exception {
|
||||
void findByDeletedPrincipalNameReload() {
|
||||
String principalName = "findByDeletedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
@@ -290,7 +290,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByChangedPrincipalNameReload() throws Exception {
|
||||
void findByChangedPrincipalNameReload() {
|
||||
String principalName = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
@@ -336,7 +336,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findBySecurityPrincipalNameExpireRemovesIndex() throws Exception {
|
||||
void findBySecurityPrincipalNameExpireRemovesIndex() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -357,7 +357,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByPrincipalNameNoSecurityPrincipalNameChange() throws Exception {
|
||||
void findByPrincipalNameNoSecurityPrincipalNameChange() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -374,7 +374,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByPrincipalNameNoSecurityPrincipalNameChangeReload() throws Exception {
|
||||
void findByPrincipalNameNoSecurityPrincipalNameChangeReload() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -393,7 +393,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByDeletedSecurityPrincipalName() throws Exception {
|
||||
void findByDeletedSecurityPrincipalName() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -409,7 +409,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByChangedSecurityPrincipalName() throws Exception {
|
||||
void findByChangedSecurityPrincipalName() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -429,7 +429,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByDeletedSecurityPrincipalNameReload() throws Exception {
|
||||
void findByDeletedSecurityPrincipalNameReload() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -446,7 +446,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void findByChangedSecurityPrincipalNameReload() throws Exception {
|
||||
void findByChangedSecurityPrincipalNameReload() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(SPRING_SECURITY_CONTEXT, this.context);
|
||||
|
||||
@@ -468,7 +468,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenOnlyChangeId() throws Exception {
|
||||
void changeSessionIdWhenOnlyChangeId() {
|
||||
String attrName = "changeSessionId";
|
||||
String attrValue = "changeSessionId-value";
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
@@ -493,7 +493,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenChangeTwice() throws Exception {
|
||||
void changeSessionIdWhenChangeTwice() {
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
|
||||
this.repository.save(toSave);
|
||||
@@ -510,7 +510,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenSetAttributeOnChangedSession() throws Exception {
|
||||
void changeSessionIdWhenSetAttributeOnChangedSession() {
|
||||
String attrName = "changeSessionId";
|
||||
String attrValue = "changeSessionId-value";
|
||||
|
||||
@@ -535,7 +535,7 @@ class RedisOperationsSessionRepositoryITests extends AbstractRedisITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenHasNotSaved() throws Exception {
|
||||
void changeSessionIdWhenHasNotSaved() {
|
||||
String attrName = "changeSessionId";
|
||||
String attrValue = "changeSessionId-value";
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class RedisOperationsSessionRepositoryFlushImmediatelyITests<S extends Session>
|
||||
private SessionRepository<S> sessionRepository;
|
||||
|
||||
@Test
|
||||
void savesOnCreate() throws InterruptedException {
|
||||
void savesOnCreate() {
|
||||
S created = this.sessionRepository.createSession();
|
||||
|
||||
S getSession = this.sessionRepository.findById(created.getId());
|
||||
|
||||
@@ -296,7 +296,7 @@ public class RedisHttpSessionConfiguration extends SpringHttpSessionConfiguratio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
public void afterPropertiesSet() {
|
||||
if (this.configure == ConfigureRedisAction.NO_OP) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,13 +159,13 @@ class RedisOperationsSessionRepositoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void createSessionDefaultMaxInactiveInterval() throws Exception {
|
||||
void createSessionDefaultMaxInactiveInterval() {
|
||||
Session session = this.redisRepository.createSession();
|
||||
assertThat(session.getMaxInactiveInterval()).isEqualTo(new MapSession().getMaxInactiveInterval());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createSessionCustomMaxInactiveInterval() throws Exception {
|
||||
void createSessionCustomMaxInactiveInterval() {
|
||||
int interval = 1;
|
||||
this.redisRepository.setDefaultMaxInactiveInterval(interval);
|
||||
Session session = this.redisRepository.createSession();
|
||||
|
||||
@@ -80,7 +80,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
|
||||
// gh-169
|
||||
@Test
|
||||
void onExpirationUpdatedRemovesOriginalExpirationTimeRoundedUp() throws Exception {
|
||||
void onExpirationUpdatedRemovesOriginalExpirationTimeRoundedUp() {
|
||||
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
|
||||
long originalRoundedToNextMinInMs = RedisSessionExpirationPolicy
|
||||
.roundUpToNextMinute(originalExpirationTimeInMs);
|
||||
@@ -94,7 +94,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onExpirationUpdatedDoNotSendDeleteWhenExpirationTimeDoesNotChange() throws Exception {
|
||||
void onExpirationUpdatedDoNotSendDeleteWhenExpirationTimeDoesNotChange() {
|
||||
long originalExpirationTimeInMs = RedisSessionExpirationPolicy.expiresInMillis(this.session) - 10;
|
||||
long originalRoundedToNextMinInMs = RedisSessionExpirationPolicy
|
||||
.roundUpToNextMinute(originalExpirationTimeInMs);
|
||||
@@ -108,7 +108,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onExpirationUpdatedAddsExpirationTimeRoundedUp() throws Exception {
|
||||
void onExpirationUpdatedAddsExpirationTimeRoundedUp() {
|
||||
long expirationTimeInMs = RedisSessionExpirationPolicy.expiresInMillis(this.session);
|
||||
long expirationRoundedUpInMs = RedisSessionExpirationPolicy.roundUpToNextMinute(expirationTimeInMs);
|
||||
String expectedExpireKey = this.policy.getExpirationKey(expirationRoundedUpInMs);
|
||||
@@ -122,7 +122,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onExpirationUpdatedSetExpireSession() throws Exception {
|
||||
void onExpirationUpdatedSetExpireSession() {
|
||||
String sessionKey = this.policy.getSessionKey(this.session.getId());
|
||||
|
||||
this.policy.onExpirationUpdated(null, this.session);
|
||||
@@ -133,7 +133,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onExpirationUpdatedDeleteOnZero() throws Exception {
|
||||
void onExpirationUpdatedDeleteOnZero() {
|
||||
String sessionKey = this.policy.getSessionKey("expires:" + this.session.getId());
|
||||
|
||||
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
|
||||
@@ -151,7 +151,7 @@ class RedisSessionExpirationPolicyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void onExpirationUpdatedPersistOnNegativeExpiration() throws Exception {
|
||||
void onExpirationUpdatedPersistOnNegativeExpiration() {
|
||||
long originalExpirationTimeInMs = ONE_MINUTE_AGO;
|
||||
|
||||
this.session.setMaxInactiveInterval(Duration.ofSeconds(-1));
|
||||
|
||||
@@ -61,7 +61,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetUnset() throws Exception {
|
||||
void afterPropertiesSetUnset() {
|
||||
setConfigNotification("");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -70,7 +70,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetA() throws Exception {
|
||||
void afterPropertiesSetA() {
|
||||
setConfigNotification("A");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -79,7 +79,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetE() throws Exception {
|
||||
void afterPropertiesSetE() {
|
||||
setConfigNotification("E");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -88,7 +88,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetK() throws Exception {
|
||||
void afterPropertiesSetK() {
|
||||
setConfigNotification("K");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -97,7 +97,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetAE() throws Exception {
|
||||
void afterPropertiesSetAE() {
|
||||
setConfigNotification("AE");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -106,7 +106,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetAK() throws Exception {
|
||||
void afterPropertiesSetAK() {
|
||||
setConfigNotification("AK");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -115,7 +115,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetEK() throws Exception {
|
||||
void afterPropertiesSetEK() {
|
||||
setConfigNotification("EK");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -124,7 +124,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetEg() throws Exception {
|
||||
void afterPropertiesSetEg() {
|
||||
setConfigNotification("Eg");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -133,7 +133,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetE$() throws Exception {
|
||||
void afterPropertiesSetE$() {
|
||||
setConfigNotification("E$");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -142,7 +142,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetKg() throws Exception {
|
||||
void afterPropertiesSetKg() {
|
||||
setConfigNotification("Kg");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
@@ -151,7 +151,7 @@ class EnableRedisKeyspaceNotificationsInitializerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void afterPropertiesSetAEK() throws Exception {
|
||||
void afterPropertiesSetAEK() {
|
||||
setConfigNotification("AEK");
|
||||
|
||||
this.initializer.afterPropertiesSet();
|
||||
|
||||
@@ -47,8 +47,7 @@ class RedisHttpSessionConfigurationMockTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoOpThenNoInteractionWithConnectionFactory()
|
||||
throws Exception {
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoOpThenNoInteractionWithConnectionFactory() {
|
||||
EnableRedisKeyspaceNotificationsInitializer init = new EnableRedisKeyspaceNotificationsInitializer(this.factory,
|
||||
ConfigureRedisAction.NO_OP);
|
||||
|
||||
@@ -58,8 +57,7 @@ class RedisHttpSessionConfigurationMockTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenExceptionThenCloseConnection()
|
||||
throws Exception {
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenExceptionThenCloseConnection() {
|
||||
ConfigureRedisAction action = mock(ConfigureRedisAction.class);
|
||||
willThrow(new RuntimeException()).given(action).configure(this.connection);
|
||||
|
||||
@@ -77,8 +75,7 @@ class RedisHttpSessionConfigurationMockTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoExceptionThenCloseConnection()
|
||||
throws Exception {
|
||||
void enableRedisKeyspaceNotificationsInitializerAfterPropertiesSetWhenNoExceptionThenCloseConnection() {
|
||||
ConfigureRedisAction action = mock(ConfigureRedisAction.class);
|
||||
|
||||
EnableRedisKeyspaceNotificationsInitializer init = new EnableRedisKeyspaceNotificationsInitializer(this.factory,
|
||||
|
||||
@@ -55,7 +55,7 @@ public class HazelcastHttpSessionConfigurationXmlTests<S extends Session> {
|
||||
private SessionRepository<S> repository;
|
||||
|
||||
@Test
|
||||
void saveSessionTest() throws InterruptedException {
|
||||
void saveSessionTest() {
|
||||
|
||||
S sessionToSave = this.repository.createSession();
|
||||
|
||||
@@ -94,7 +94,7 @@ public class HazelcastHttpSessionConfigurationXmlTests<S extends Session> {
|
||||
private SessionRepository<S> repository;
|
||||
|
||||
@Test
|
||||
void saveSessionTest() throws InterruptedException {
|
||||
void saveSessionTest() {
|
||||
|
||||
S sessionToSave = this.repository.createSession();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MessageController {
|
||||
}
|
||||
|
||||
@SubscribeMapping("/users")
|
||||
public List<String> subscribeMessages() throws Exception {
|
||||
public List<String> subscribeMessages() {
|
||||
return this.activeUserRepository.findAllActiveUsers();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -29,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -28,7 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,6 @@
|
||||
package sample;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.h2.server.web.WebServlet;
|
||||
|
||||
@@ -25,7 +24,7 @@ import org.springframework.web.WebApplicationInitializer;
|
||||
public class H2ConsoleInitializer implements WebApplicationInitializer {
|
||||
|
||||
@Override
|
||||
public void onStartup(ServletContext servletContext) throws ServletException {
|
||||
public void onStartup(ServletContext servletContext) {
|
||||
servletContext.addServlet("h2Console", new WebServlet()).addMapping("/h2-console/*");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -28,7 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -29,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -28,7 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -31,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -17,7 +17,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -26,7 +25,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
@@ -18,7 +18,6 @@ package sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -27,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
|
||||
Reference in New Issue
Block a user