本文介绍了在嵌入式underwow中部署servlets webapp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有简单的方法来部署嵌入了undertow的servlets Web应用程序?

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();

是否有类似的方法可以对undertow进行此操作?我在这里看到了一个示例: https://github.com/undertow-io/undertow/blob/master/examples/src/main/java/io/undertow/examples/servlet/ServletServer.java ,但不是我想要的,它一一注册了servlet ...

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...

推荐答案

暂时没有.

Undertow仅提供了一个构建器API,另一个应用程序可以使用该API来构建Servlet.这是一个有意的设计选择,因为它使嵌入式应用程序可以完全控制部署.

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.

我们最终可能会在其他模块中添加对此功能的支持(很可能是通过将相关代码从Wildfly中删除),但是目前它在优先级列表中并不算高.

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.

这篇关于在嵌入式underwow中部署servlets webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 01:53