First my use case: I use the jetty-maven-plugin to test my developed stuff locally and everytime I restart jetty the sessions are gone and I have to login again. To speedup development a bit, it would be great to persist the session and keep me logged in.
After searching a while I found a solution here on StackOverflow, but because the class structure changed from Jetty 9.3 to Jetty 9.4 (or 10 what I’m using here), it is not possible to simply copy the configuration.
The HashSessionManager is no longer there and so I checked the source and some xml configurations and came up with this solution (which is not working):
<sessionHandler implementation="org.eclipse.jetty.server.session.SessionHandler">
<sessionCache implementation="org.eclipse.jetty.server.session.DefaultSessionCache">
<sessionDataStore implementation="org.eclipse.jetty.server.session.FileSessionDataStore">
<storeDir>${basedir}/target/jetty-sessions</storeDir>
</sessionDataStore>
</sessionCache>
</sessionHandler>
The problem, according to the maven output, is the DefaultSessionCache has only a constructor with parameter, but the xml above needs one without any parameters. So I’m stuck here, but maybe someone has a great idea, how I can build a working configuration or another simple solution.
1