use of io.undertow.server.handlers.resource.PathResourceManager in project wildfly by wildfly.
the class WebHostService method addWebDeployment.
@Override
public WebDeploymentController addWebDeployment(final WebDeploymentBuilder webDeploymentBuilder) {
DeploymentInfo d = new DeploymentInfo();
d.setDeploymentName(webDeploymentBuilder.getContextRoot());
d.setContextPath(webDeploymentBuilder.getContextRoot());
d.setClassLoader(webDeploymentBuilder.getClassLoader());
d.setResourceManager(new PathResourceManager(webDeploymentBuilder.getDocumentRoot().toPath().toAbsolutePath(), 1024L * 1024L));
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