Open yisraelU opened 6 years ago
spark v2.7.0 in your main method
private static JettyHandler setupHandler(Routes routeMatcher, StaticFilesConfiguration staticFilesConfiguration, boolean hasMultipleHandler) {
MatcherFilter matcherFilter = new MatcherFilter(routeMatcher, staticFilesConfiguration, false, hasMultipleHandler);
matcherFilter.init(null);
return new JettyHandler(matcherFilter);
}
EmbeddedServers.add(EmbeddedServers.Identifiers.JETTY, (Routes routeMatcher, StaticFilesConfiguration staticFilesConfiguration, boolean hasMultipleHandler) -> {
handler = setupHandler(routeMatcher, staticFilesConfiguration, hasMultipleHandler);
//handler.getSessionCookieConfig().setName("XSESSION");
handler.addEventListener(new TestListener());
return new EmbeddedJettyServer(new JettyServerFactory() {
@Override
public Server create(int maxThreads, int minThreads, int threadTimeoutMillis) { return new Server(); }
@Override
public Server create(ThreadPool tp) { throw new UnsupportedOperationException("Not supported yet."); }
}, handler);
});
public class TestListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent hse) {
System.out.println("sessionCreated : "+hse.getSession().getId()+ " : " +new Date().toString() );
}
@Override
public void sessionDestroyed(HttpSessionEvent hse) {
System.out.println("sessionDestroyed : "+hse.getSession().getId()+" : "+new Date().toString());
}
}
is the anyway to access the session listener and customize it