use of org.eclipse.jetty.xml.XmlConfiguration in project ddf by codice.
the class JettySessionManagementTest method setupClass.
@BeforeClass
public static void setupClass() throws Exception {
// To get the AccessRequestLog to log in the target folder
System.setProperty("ddf.data", "target");
server = new Server();
HandlerList handlers = new HandlerList();
server.setHandler(handlers);
// Configure server according to the jetty.xml file
XmlConfiguration configuration = new XmlConfiguration(JettySessionManagementTest.class.getResourceAsStream("/jetty-session.xml"));
configuration.configure(server);
// Have server bind to first available port
ServerConnector connector = new ServerConnector(server);
connector.setPort(0);
server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler(null, "/context1", ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new TestServlet()), "/");
context.getSessionHandler().setMaxInactiveInterval(MAX_INACTIVE_INTERVAL_SECONDS);
handlers.addHandler(context);
ServletContextHandler context2 = new ServletContextHandler(null, "/context2", ServletContextHandler.SESSIONS);
context2.addServlet(new ServletHolder(new TestServlet()), "/");
context2.getSessionHandler().setMaxInactiveInterval(MAX_INACTIVE_INTERVAL_SECONDS);
handlers.addHandler(context2);
HouseKeeper houseKeeper = new HouseKeeper();
houseKeeper.setIntervalSec(SCAVENGE_INTERVAL_SECONDS);
server.getSessionIdManager().setSessionHouseKeeper(houseKeeper);
server.start();
port = connector.getLocalPort();
}
use of org.eclipse.jetty.xml.XmlConfiguration in project i2p.i2p by i2p.
the class JettyStart method parseArgs.
/**
* Modified from XmlConfiguration.main()
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void parseArgs(String[] args) throws Exception {
Properties properties = new Properties();
XmlConfiguration last = null;
for (int i = 0; i < args.length; i++) {
File f = new File(args[i]);
if (args[i].toLowerCase().endsWith(".properties")) {
InputStream in = null;
try {
in = new FileInputStream(f);
properties.load(in);
} finally {
if (in != null)
try {
in.close();
} catch (IOException ioe) {
}
}
} else {
URL configUrl = f.toURI().toURL();
XmlConfiguration configuration = new XmlConfiguration(configUrl);
if (last != null)
configuration.getIdMap().putAll(last.getIdMap());
if (properties.size() > 0) {
// to avoid compiler errror
Map foo = configuration.getProperties();
foo.putAll(properties);
}
Object o = configuration.configure();
if (o instanceof LifeCycle)
_jettys.add((LifeCycle) o);
last = configuration;
}
}
}
use of org.eclipse.jetty.xml.XmlConfiguration in project killbill by killbill.
the class HttpServer method configure.
public void configure(final String jettyXml) throws Exception {
final XmlConfiguration configuration = new XmlConfiguration(Resources.getResource(jettyXml));
configuration.configure(server);
}
Aggregations