use of cn.taketoday.web.framework.server.AbstractWebServer in project today-framework by TAKETODAY.
the class WebApplicationUtils method obtainWebServer.
/**
* Obtain a {@link WebServer} form bean-factory
*
* @param beanFactory Target bean-factory
* @return WebServer
*/
public static WebServer obtainWebServer(WebServerApplicationContext beanFactory) {
// disable web mvc xml
TodayStrategies.setProperty(WebApplicationLoader.ENABLE_WEB_MVC_XML, "false");
// Get WebServer instance
WebServer webServer = beanFactory.getBean(WebServer.class);
if (webServer == null) {
throw new ConfigurationException("The bean factory: [" + beanFactory + "] doesn't exist a [cn.taketoday.web.framework.server.WebServer] bean");
}
if (webServer instanceof ConfigurableWebServer) {
if (webServer instanceof AbstractWebServer) {
((AbstractWebServer) webServer).getWebApplicationConfiguration().configureWebServer((AbstractWebServer) webServer);
}
((ConfigurableWebServer) webServer).initialize();
}
return webServer;
}
Aggregations