/** * Create a server for the given router. * * @param router The router for the server to serve. * @param mode The mode the server will run on. * @param port The port the server will run on. * @return The running server. */ public static Server forRouter(Router router, Mode mode, int port) { return new Server(JavaServerHelper.forRouter(router, JavaModeConverter.asScalaMode(mode), port)); }
/** * Build the server and begin serving the provided routes as configured. * * @param block the router to use. * @return the actively running server. */ public Server build(Function<BuiltInComponents, Router> block) { Server.Config config = _buildConfig(); return new Server( JavaServerHelper.forRouter( JavaModeConverter.asScalaMode(config.mode()), OptionConverters.toScala(config.maybeHttpPort()), OptionConverters.toScala(config.maybeHttpsPort()), block ) ); }
/** * Build the server and begin serving the provided routes as configured. * * @param block the router to use. * @return the actively running server. */ public Server build(Function<BuiltInComponents, Router> block) { Server.Config config = _buildConfig(); return new Server( JavaServerHelper.forRouter( JavaModeConverter.asScalaMode(config.mode()), OptionConverters.toScala(config.maybeHttpPort()), OptionConverters.toScala(config.maybeHttpsPort()), block ) ); }
public static void main(String[] args) throws Exception { try { File root = new File(System.getProperty("application.path", ".")); if (System.getProperty("precompiled", "false").equals("true")) { Play.usePrecompiled = true; } if (System.getProperty("writepid", "false").equals("true")) { writePID(root); } Play.init(root, System.getProperty("play.id", "")); if (System.getProperty("precompile") == null) { new Server(args); } else { Logger.info("Done."); } } catch (Throwable e) { Logger.fatal(e, "Failed to start"); System.exit(1); } } }