|
25 | 25 | import io.undertow.server.session.InMemorySessionManager; |
26 | 26 | import io.undertow.server.session.Session; |
27 | 27 | import io.undertow.servlet.handlers.ServletRequestContext; |
| 28 | +import org.apache.commons.lang.reflect.FieldUtils; |
28 | 29 | import org.apache.commons.logging.Log; |
29 | 30 | import org.apache.commons.logging.LogFactory; |
30 | 31 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
36 | 37 | import javax.inject.Inject; |
37 | 38 | import java.time.Instant; |
38 | 39 | import java.util.HashSet; |
39 | | -import java.util.Objects; |
40 | 40 | import java.util.Set; |
41 | 41 | import java.util.Timer; |
42 | 42 | import java.util.TimerTask; |
43 | | -import java.util.stream.Collectors; |
44 | 43 |
|
45 | 44 | @Component |
46 | 45 | @ConditionalOnProperty(name = "spring.session.store-type", havingValue = "none") |
@@ -80,7 +79,16 @@ public Integer getActiveUsersCount() { |
80 | 79 |
|
81 | 80 | @Override |
82 | 81 | public void reActivateSession(String sessionId) { |
83 | | - customInMemorySessionManagerFactory.getInstance().getSession(sessionId).requestDone(new HttpServerExchange(null)); |
| 82 | + Session session = customInMemorySessionManagerFactory.getInstance().getSession(sessionId); |
| 83 | + try { |
| 84 | + // TODO: this is hack we would prefer not to use, let's discuss with Undertow developers to provide |
| 85 | + // a method similar to Spring's session setLastAccessedTime() method |
| 86 | + FieldUtils.writeField(session, "lastAccessed", System.currentTimeMillis(), true); |
| 87 | + } catch (IllegalAccessException e) { |
| 88 | + e.printStackTrace(); |
| 89 | + } |
| 90 | + // called for the SessionImpl.bumpTimeout() method |
| 91 | + session.requestDone(new HttpServerExchange(null)); |
84 | 92 | } |
85 | 93 |
|
86 | 94 | @Override |
|
0 commit comments