Search code examples
javajbossundertow

Deploying servlets webapp in embedded undertow


Is there any easy way to deploy a servlets web application with undertow embbeded?

For example, with jetty, I can deploy like this:

    Server server = new Server(8080);
    WebAppContext context = new WebAppContext();
    context.setContextPath("/");
    context.setDescriptor("src/main/webapp/web.xml");
    context.setResourceBase("src/main/webapp/");
    server.setHandler(context);
    server.start();

Is there a similar way of doing this with undertow? I saw a example here: https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/servlet/ServletServer.java, but it's not exaclty what I want, it registers the servlets one by one...


Solution

  • Not at the moment.

    Undertow just provides a builder API, that another application can use to build up a Servlet. This was a deliberate design choice as it gives the embedding application full control of the deployment.

    We may eventually add support for this in a different module (most likely by ripping the relevant code out of Wildfly), but it is not high on the priority list at the moment.