SslSocketConnector connector = new SslSocketConnector(factory);
connector.setPort(sslPort);
server.addConnector(connector);
}
ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
root.setContextPath("/");
server.setHandler(root);
root.addServlet(new ServletHolder(new VhostsServlet(_broker)), "/api/vhosts/*");
root.addServlet(new ServletHolder(new ExchangesServlet(_broker)), "/api/exchanges/*");
addRestServlet(root, "broker");
addRestServlet(root, "virtualhost", VirtualHost.class);
addRestServlet(root, "authenticationprovider", AuthenticationProvider.class);
addRestServlet(root, "user", AuthenticationProvider.class, User.class);
addRestServlet(root, "exchange", VirtualHost.class, Exchange.class);
addRestServlet(root, "queue", VirtualHost.class, Queue.class);
addRestServlet(root, "connection", VirtualHost.class, Connection.class);
addRestServlet(root, "binding", VirtualHost.class, Exchange.class, Queue.class, Binding.class);
addRestServlet(root, "port", Port.class);
addRestServlet(root, "session", VirtualHost.class, Connection.class, Session.class);
root.addServlet(new ServletHolder(new StructureServlet(_broker)), "/rest/structure");
root.addServlet(new ServletHolder(new MessageServlet(_broker)), "/rest/message/*");
root.addServlet(new ServletHolder(new MessageContentServlet(_broker)), "/rest/message-content/*");
root.addServlet(new ServletHolder(new LogRecordsServlet(_broker)), "/rest/logrecords");
root.addServlet(new ServletHolder(new SaslServlet(_broker)), "/rest/sasl");
root.addServlet(new ServletHolder(new DefinedFileServlet("management.html")), "/management");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.js");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.css");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.html");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.png");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.gif");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.jpg");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.jpeg");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.json");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.txt");
root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.xsl");
final SessionManager sessionManager = root.getSessionHandler().getSessionManager();
sessionManager.setMaxInactiveInterval(60 * 15);
return server;
}