use of io.undertow.servlet.api.DeploymentInfo 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.DeploymentInfo in project wildfly by wildfly.
the class UndertowContextTestCase method getPath.
@Test
public void getPath() {
DeploymentInfo info = new DeploymentInfo();
String expected = "";
info.setContextPath(expected);
when(this.deployment.getDeploymentInfo()).thenReturn(info);
String result = this.context.getPath();
assertSame(expected, result);
}
use of io.undertow.servlet.api.DeploymentInfo in project wildfly by wildfly.
the class UndertowHostTestCase method findContext.
@Test
public void findContext() {
Deployment deployment = mock(Deployment.class);
DeploymentInfo info = new DeploymentInfo();
String expectedPath = "";
info.setContextPath(expectedPath);
HttpHandler handler = mock(HttpHandler.class);
when(deployment.getDeploymentInfo()).thenReturn(info);
this.undertowHost.registerDeployment(deployment, handler);
Context result = this.host.findContext(expectedPath);
assertSame(this.host, result.getHost());
assertSame(expectedPath, result.getPath());
result = this.host.findContext("unknown");
assertNull(result);
}
use of io.undertow.servlet.api.DeploymentInfo in project wildfly by wildfly.
the class UndertowHostTestCase method getContexts.
@Test
public void getContexts() {
Deployment deployment = mock(Deployment.class);
DeploymentInfo info = new DeploymentInfo();
String expectedPath = "";
info.setContextPath(expectedPath);
HttpHandler handler = mock(HttpHandler.class);
when(deployment.getDeploymentInfo()).thenReturn(info);
this.undertowHost.registerDeployment(deployment, handler);
Iterator<Context> result = this.host.getContexts().iterator();
assertTrue(result.hasNext());
Context context = result.next();
assertSame(this.host, context.getHost());
assertSame(expectedPath, context.getPath());
assertFalse(result.hasNext());
}
use of io.undertow.servlet.api.DeploymentInfo in project wildfly by wildfly.
the class VolatileParticipantService method deployParticipant.
private void deployParticipant() {
undeployServlet();
final Map<String, String> initialParameters = new HashMap<String, String>();
initialParameters.put("javax.ws.rs.Application", VolatileParticipantApplication.class.getName());
final DeploymentInfo participantDeploymentInfo = getDeploymentInfo(DEPLOYMENT_NAME, CONTEXT_PATH, initialParameters);
deployServlet(participantDeploymentInfo);
}
Aggregations