use of io.undertow.servlet.util.ImmediateInstanceFactory in project wildfly by wildfly.
the class WebHostService method addWebDeployment.
@Override
public WebDeploymentController addWebDeployment(final WebDeploymentBuilder webDeploymentBuilder) throws Exception {
DeploymentInfo d = new DeploymentInfo();
d.setDeploymentName(webDeploymentBuilder.getContextRoot());
d.setContextPath(webDeploymentBuilder.getContextRoot());
d.setClassLoader(webDeploymentBuilder.getClassLoader());
d.setResourceManager(new FileResourceManager(webDeploymentBuilder.getDocumentRoot().getCanonicalFile(), 1024 * 1024));
d.setIgnoreFlush(false);
for (ServletBuilder servlet : webDeploymentBuilder.getServlets()) {
ServletInfo s;
if (servlet.getServlet() == null) {
s = new ServletInfo(servlet.getServletName(), (Class<? extends Servlet>) servlet.getServletClass());
} else {
s = new ServletInfo(servlet.getServletName(), (Class<? extends Servlet>) servlet.getServletClass(), new ImmediateInstanceFactory<>(servlet.getServlet()));
}
if (servlet.isForceInit()) {
s.setLoadOnStartup(1);
}
s.addMappings(servlet.getUrlMappings());
for (Map.Entry<String, String> param : servlet.getInitParams().entrySet()) {
s.addInitParam(param.getKey(), param.getValue());
}
d.addServlet(s);
}
if (controlPoint != null) {
d.addOuterHandlerChainWrapper(GlobalRequestControllerHandler.wrapper(controlPoint, webDeploymentBuilder.getAllowRequestPredicates()));
}
return new WebDeploymentControllerImpl(d);
}
Aggregations