Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startServer(String address, int port) throws Exception {
- Server server = new Server();
- ServerConnector c = new ServerConnector(server);
- c.setIdleTimeout(1000);
- c.setAcceptQueueSize(10);
- c.setPort(port);
- c.setHost(address);
- WebAppContext webapp = new WebAppContext();
- webapp.setResourceBase("src/main/webapp");
- webapp.setConfigurations(new Configuration[]{
- new WebInfConfiguration(),
- new WebXmlConfiguration(),
- new MetaInfConfiguration(),
- new FragmentConfiguration(),
- new EnvConfiguration(),
- new PlusConfiguration(),
- new AnnotationConfiguration(),
- new JettyWebXmlConfiguration()});
- webapp.setContextPath("/myapp");
- webapp.setParentLoaderPriority(true);
- // webapp.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
- // ".*/target/classes/");
- server.setHandler(webapp);
- server.addConnector(c);
- server.start();
- server.join();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement