use of io.undertow.servlet.api.DeploymentManager in project spring-boot by spring-projects.
the class UndertowServletWebServerFactory method createDeploymentManager.
private DeploymentManager createDeploymentManager(ServletContextInitializer... initializers) {
DeploymentInfo deployment = Servlets.deployment();
registerServletContainerInitializerToDriveServletContextInitializers(deployment, initializers);
deployment.setClassLoader(getServletClassLoader());
deployment.setContextPath(getContextPath());
deployment.setDisplayName(getDisplayName());
deployment.setDeploymentName("spring-boot");
if (isRegisterDefaultServlet()) {
deployment.addServlet(Servlets.servlet("default", DefaultServlet.class));
}
configureErrorPages(deployment);
deployment.setServletStackTraces(ServletStackTraces.NONE);
deployment.setResourceManager(getDocumentRootResourceManager());
configureMimeMappings(deployment);
for (UndertowDeploymentInfoCustomizer customizer : this.deploymentInfoCustomizers) {
customizer.customize(deployment);
}
if (isAccessLogEnabled()) {
configureAccessLog(deployment);
}
if (isPersistSession()) {
File dir = getValidSessionStoreDir();
deployment.setSessionPersistenceManager(new FileSessionPersistence(dir));
}
addLocaleMappings(deployment);
DeploymentManager manager = Servlets.newContainer().addDeployment(deployment);
manager.deploy();
SessionManager sessionManager = manager.getDeployment().getSessionManager();
int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
sessionManager.setDefaultSessionTimeout(sessionTimeout);
return manager;
}
use of io.undertow.servlet.api.DeploymentManager in project spring-boot by spring-projects.
the class UndertowServletWebServerFactory method getWebServer.
@Override
public WebServer getWebServer(ServletContextInitializer... initializers) {
DeploymentManager manager = createDeploymentManager(initializers);
int port = getPort();
Builder builder = createBuilder(port);
return getUndertowWebServer(builder, manager, port);
}
use of io.undertow.servlet.api.DeploymentManager in project wildfly by wildfly.
the class AbstractRTSService method deployServlet.
protected void deployServlet(final DeploymentInfo deploymentInfo) {
DeploymentManager manager = ServletContainer.Factory.newInstance().addDeployment(deploymentInfo);
manager.deploy();
deployment = manager.getDeployment();
try {
injectedHost.getValue().registerDeployment(deployment, manager.start());
} catch (ServletException e) {
RTSLogger.ROOT_LOGGER.warn(e.getMessage(), e);
deployment = null;
}
}
use of io.undertow.servlet.api.DeploymentManager in project undertow by undertow-io.
the class SessionIdHandlingTestCase method setup.
@BeforeClass
public static void setup() throws ServletException {
final PathHandler pathHandler = new PathHandler();
final ServletContainer container = ServletContainer.Factory.newInstance();
DeploymentInfo builder = new DeploymentInfo().setClassLoader(SimpleServletTestCase.class.getClassLoader()).setContextPath("/servletContext").setClassIntrospecter(TestClassIntrospector.INSTANCE).setDeploymentName("servletContext.war").addServlets(new ServletInfo("servlet", RequestedSessionIdServlet.class).addMapping("/session"));
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
try {
pathHandler.addPrefixPath(builder.getContextPath(), manager.start());
} catch (ServletException e) {
throw new RuntimeException(e);
}
DefaultServer.setRootHandler(pathHandler);
}
use of io.undertow.servlet.api.DeploymentManager in project undertow by undertow-io.
the class ParameterEchoTestCase method setup.
@BeforeClass
public static void setup() throws ServletException {
final PathHandler root = new PathHandler();
final ServletContainer container = ServletContainer.Factory.newInstance();
ServletInfo s = new ServletInfo("servlet", ParameterEchoServlet.class).addMapping("/aaa");
DeploymentInfo builder = new DeploymentInfo().setClassLoader(ParameterEchoTestCase.class.getClassLoader()).setContextPath("/servletContext").setClassIntrospecter(TestClassIntrospector.INSTANCE).setDeploymentName("servletContext.war").addServlet(s);
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
root.addPrefixPath(builder.getContextPath(), manager.start());
DefaultServer.setRootHandler(root);
}
Aggregations