Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As jetty config files are direct mappings of xml to java, it is quite straightforward to see how this would be done in code, but here's an example anyway:

Code Block
java
java

Server server = new Server();
    ...
    JDBCSessionIdManager idMgr = new JDBCSessionIdManager(server);
    idMgr.setWorkerName("fred");
    idMgr.setDriverInfo("com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/sessions?user=janb");
    idMgr.setScavengeInterval(60);
    server.setSessionIdManager(idMgr);

...

If you're embedding this in code:

Code Block
java
java
 //assuming you have already set up the JDBCSessionIdManager as shown earlier
 //and have a reference to the Server instance:

 WebAppContext wac = new WebAppContext();
 ... //configure your webapp context
 JDBCSessionManager jdbcMgr = new JDBCSessionManager();
 jdbcMgr.setIdManager(server.getSessionIdManager());
 wac.setSessionHandler(jdbcMgr);
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery