Search in sources :

Example 66 with ServletInfo

use of io.undertow.servlet.api.ServletInfo 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);
}
Also used : ServletInfo(io.undertow.servlet.api.ServletInfo) FileResourceManager(io.undertow.server.handlers.resource.FileResourceManager) ServletBuilder(org.jboss.as.web.host.ServletBuilder) Servlet(javax.servlet.Servlet) ImmediateInstanceFactory(io.undertow.servlet.util.ImmediateInstanceFactory) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) Map(java.util.Map)

Example 67 with ServletInfo

use of io.undertow.servlet.api.ServletInfo in project indy by Commonjava.

the class DotMavenDeploymentProvider method getDeploymentInfo.

@Override
public DeploymentInfo getDeploymentInfo() {
    final ServletInfo servletInfo = Servlets.servlet("DotMaven", DotMavenServlet.class).setAsyncSupported(true).setLoadOnStartup(3).addMapping("/mavdav*").addMapping("/mavdav/*");
    servletInfo.setInstanceFactory(new ImmediateInstanceFactory<Servlet>(servlet));
    return new DeploymentInfo().addServlet(servletInfo);
}
Also used : ServletInfo(io.undertow.servlet.api.ServletInfo) Servlet(javax.servlet.Servlet) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo)

Aggregations

ServletInfo (io.undertow.servlet.api.ServletInfo)67 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)58 ServletContainer (io.undertow.servlet.api.ServletContainer)51 DeploymentManager (io.undertow.servlet.api.DeploymentManager)50 PathHandler (io.undertow.server.handlers.PathHandler)49 BeforeClass (org.junit.BeforeClass)43 FilterInfo (io.undertow.servlet.api.FilterInfo)15 SimpleServletTestCase (io.undertow.servlet.test.SimpleServletTestCase)14 LoginConfig (io.undertow.servlet.api.LoginConfig)13 ListenerInfo (io.undertow.servlet.api.ListenerInfo)11 TestResourceLoader (io.undertow.servlet.test.util.TestResourceLoader)11 SecurityConstraint (io.undertow.servlet.api.SecurityConstraint)10 WebResourceCollection (io.undertow.servlet.api.WebResourceCollection)9 ServletIdentityManager (io.undertow.servlet.test.security.constraint.ServletIdentityManager)9 Test (org.junit.Test)9 TestHttpClient (io.undertow.testutils.TestHttpClient)8 ServletSecurityInfo (io.undertow.servlet.api.ServletSecurityInfo)7 MessageServlet (io.undertow.servlet.test.util.MessageServlet)6 Servlet (javax.servlet.Servlet)6 ServletException (javax.servlet.ServletException)6