public int getHttpPort() { return webApp.port(); } }
@Override protected void serviceStop() throws Exception { if (server != null) { server.stop(); } if (webApp != null) { webApp.stop(); } super.serviceStop(); }
webAppBuild.invoke(WebApps.$for("jobhistory", HistoryClientService.class, this, "ws").with(conf).withHttpSpnegoKeytabKey(XLearningConfiguration.XLEARNING_WEBAPP_SPNEGO_KEYTAB_FILE_KEY).withHttpSpnegoPrincipalKey(XLearningConfiguration.XLEARNING_WEBAPP_SPNEGO_USER_NAME_KEY).at(NetUtils.getHostPortString(bindAddress)), webApp); HttpServer2 httpServer = webApp.httpServer(); WebAppContext webAppContext = httpServer.getWebAppContext(); WebAppContext appWebAppContext = new WebAppContext(); try { httpServer.start(); LOG.info("Web app " + webApp.name() + " started at " + httpServer.getConnectorAddress(0).getPort()); } catch (IOException e) { throw new WebAppException("Error starting http server", e); .$for("jobhistory", HistoryClientService.class, this, "ws") .with(conf) .withHttpSpnegoKeytabKey( XLearningConfiguration.XLEARNING_WEBAPP_SPNEGO_KEYTAB_FILE_KEY) .withHttpSpnegoPrincipalKey( XLearningConfiguration.XLEARNING_WEBAPP_SPNEGO_USER_NAME_KEY) .at(NetUtils.getHostPortString(bindAddress)).start(webApp); } catch (WebAppException e){ throw new WebAppException("Error starting http server", e); } catch (Exception e){ throw new WebAppException("Error start http server. For more detail", e); connectHost + ":" + webApp.getListenerAddress().getPort());
public static void main(String[] args) throws Exception { // For manual controller/view testing. WebApps.$for("test", new TestWebApp()).at(8888).inDevMode().start(). joinThread(); // start(new WebApp() { // @Override public void setup() { // route("/:foo", FooController.class); // route("/foo/:foo", FooController.class); // route("/bar", FooController.class); // } // }).join(); } }
try { Method webAppBuild = WebApps.Builder.class.getMethod("build", WebApp.class); webApp = (WebApp) webAppBuild.invoke(WebApps.$for("proxy", ApplicationContext.class, applicationContext, null).with(getConfig()), new AMWebApp()); HttpServer2 httpServer = webApp.httpServer(); try { httpServer.start(); LOG.info("Web app " + webApp.name() + " started at " + httpServer.getConnectorAddress(0).getPort()); } catch (IOException e) { throw new WebAppException("Error starting http server", e); webApp = WebApps.$for("proxy", ApplicationContext.class, applicationContext, null).with(getConfig()).start(new AMWebApp()); } catch (Exception e) { LOG.error("Error starting application web server!", e);
/** * Render a sub-view * @param cls the class of the sub-view */ public void render(Class<? extends SubView> cls) { int saved = context().nestLevel; getInstance(cls).renderPartial(); if (context().nestLevel != saved) { throw new WebAppException("View "+ cls.getSimpleName() +" not complete"); } } }
/** * Resolve a path to a destination. */ synchronized Dest resolve(String httpMethod, String path) { WebApp.HTTP method = WebApp.HTTP.valueOf(httpMethod); // can throw Dest dest = lookupRoute(method, path); if (dest == null) { return resolveDefault(method, path); } return dest; }
protected void render(Class<? extends View> cls) { context().rendered = true; getInstance(cls).render(); }
/** * Get the cookies * @return the cookies map */ public Map<String, Cookie> cookies() { return context().requestContext().cookies(); }
public static void main(String[] args) throws Exception { // For manual controller/view testing. WebApps.$for("test", new TestWebApp()).at(8888).inDevMode().start(). joinThread(); // start(new WebApp() { // @Override public void setup() { // route("/:foo", FooController.class); // route("/foo/:foo", FooController.class); // route("/bar", FooController.class); // } // }).join(); } }
/** * Resolve a path to a destination. */ synchronized Dest resolve(String httpMethod, String path) { WebApp.HTTP method = WebApp.HTTP.valueOf(httpMethod); // can throw Dest dest = lookupRoute(method, path); if (dest == null) { return resolveDefault(method, path); } return dest; }
public static void main(String[] args) throws Exception { // For manual controller/view testing. WebApps.$for("test", new TestWebApp()).at(8888).inDevMode().start(). joinThread(); // start(new WebApp() { // @Override public void setup() { // route("/:foo", FooController.class); // route("/foo/:foo", FooController.class); // route("/bar", FooController.class); // } // }).join(); } }
/** * Resolve a path to a destination. */ synchronized Dest resolve(String httpMethod, String path) { WebApp.HTTP method = WebApp.HTTP.valueOf(httpMethod); // can throw Dest dest = lookupRoute(method, path); if (dest == null) { return resolveDefault(method, path); } return dest; }
public static void main(String[] args) { WebApps.$for("test").at(8888).inDevMode().start().joinThread(); } }
public static void main(String[] args) { WebApps.$for("test").at(8888).inDevMode().start().joinThread(); } }
public static void main(String[] args) { WebApps.$for("test").at(8888).inDevMode().start().joinThread(); } }
public static void main(String[] args) { WebApps.$for("test").at(8888).inDevMode().start().joinThread(); } }