在嵌入式 undertow 中部署 servlets webapp [英] Deploying servlets webapp in embedded undertow
问题描述
有没有什么简单的方法可以部署一个嵌入了 undertow 的 servlets Web 应用程序?
Is there any easy way to deploy a servlets web application with undertow embbeded?
例如,使用jetty,我可以这样部署:
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,另一个应用程序可以使用它来构建一个 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.
这篇关于在嵌入式 undertow 中部署 servlets webapp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!