use of io.undertow.servlet.api.DeploymentInfo in project undertow by undertow-io.
the class FilterRegistrationImpl method getServletNameMappings.
@Override
public Collection<String> getServletNameMappings() {
DeploymentInfo deploymentInfo = deployment.getDeploymentInfo();
final List<String> ret = new ArrayList<>();
for (final FilterMappingInfo mapping : deploymentInfo.getFilterMappings()) {
if (mapping.getMappingType() == FilterMappingInfo.MappingType.SERVLET) {
if (mapping.getFilterName().equals(filterInfo.getName())) {
ret.add(mapping.getMapping());
}
}
}
return ret;
}
use of io.undertow.servlet.api.DeploymentInfo in project undertow by undertow-io.
the class JSRWebSocketServer method main.
public static void main(final String[] args) {
PathHandler path = Handlers.path();
Undertow server = Undertow.builder().addHttpListener(8080, "localhost").setHandler(path).build();
server.start();
final ServletContainer container = ServletContainer.Factory.newInstance();
DeploymentInfo builder = new DeploymentInfo().setClassLoader(JSRWebSocketServer.class.getClassLoader()).setContextPath("/").addWelcomePage("index.html").setResourceManager(new ClassPathResourceManager(JSRWebSocketServer.class.getClassLoader(), JSRWebSocketServer.class.getPackage())).addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo().setBuffers(new DefaultByteBufferPool(true, 100)).addEndpoint(JsrChatWebSocketEndpoint.class)).setDeploymentName("chat.war");
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
try {
path.addPrefixPath("/", manager.start());
} catch (ServletException e) {
throw new RuntimeException(e);
}
}
use of io.undertow.servlet.api.DeploymentInfo in project undertow by undertow-io.
the class ServletContainerImpl method addDeployment.
@Override
public DeploymentManager addDeployment(final DeploymentInfo deployment) {
final DeploymentInfo dep = deployment.clone();
DeploymentManager deploymentManager = new DeploymentManagerImpl(dep, this);
deployments.put(dep.getDeploymentName(), deploymentManager);
deploymentsByPath.put(dep.getContextPath(), deploymentManager);
return deploymentManager;
}
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);
}
Aggregations