Java Jetty 的轻量级替代品
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22472845/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Lightweight alternative to Jetty
提问by Alex
Usually Jettyis mentioned as thelightweight alternative when it comes to servlet containers like Tomcat and App Servers like Glassfish.
通常码头被提及的时候还像Tomcat和应用服务器比如GlassFish servlet容器轻量级替代。
I want to run a RESTful service on CloudFoundry. Using jetty-runner
我想在 CloudFoundry 上运行 RESTful 服务。使用码头跑步者
java -jar target/dependency/jetty-runner.jar target/*.war
works kind of fine, except I kind of run into problems running Jetty 9.1.3 (current stable) /w Java 8. So I contributed a patchto fix this issue and some other minor code cleanup patches. Hereby I saw the code of Jetty which was not in a shape I hoped it to be...
工作得很好,除了我在运行 Jetty 9.1.3 (current stable) /w Java 8 时遇到问题。所以我贡献了一个补丁来解决这个问题和其他一些小的代码清理补丁。特此我看到了 Jetty 的代码,它不是我希望它的形状......
Well I just don't want to entrust my enterprise app to Jetty and looking for alternatives. Also with 5.x MB, jetty-runner.jaris still huge. I managed to strip it down to 1.6 MBand I was still able to run my app. So an even more lightweight approach is feasible.
好吧,我只是不想将我的企业应用程序委托给 Jetty 并寻找替代方案。同样使用5.x MB,jetty-runner.jar仍然很大。我设法将其精简到 1.6 MB,但我仍然能够运行我的应用程序。因此,更轻量级的方法是可行的。
Is there a lightweight version of GlassFish or Tomcat. I just need the servlet-api.jar (v3.1) being run in a web server context. No JSP, no websocket-server, no other Voodoo.
是否有轻量级版本的 GlassFish 或 Tomcat。我只需要在 Web 服务器上下文中运行 servlet-api.jar (v3.1)。没有 JSP,没有 websocket 服务器,没有其他 Voodoo。
采纳答案by DmitryKanunnikoff
Undertow is a flexible performant web server written in java, providing both blocking and non-blocking API's based on NIO.
Undertow has a composition based architecture that allows you to build a web server by combining small single purpose handlers. The gives you the flexibility to choose between a full Java EE servlet 3.1 container, or a low level non-blocking handler, to anything in between.
Undertow is extremely lightweight, with the Undertow core jar coming in at under 1Mb. It is lightweight at runtime too, with a simple embedded server using less than 4Mb of heap space.
Undertow 是一个用 Java 编写的灵活的高性能 Web 服务器,提供基于 NIO 的阻塞和非阻塞 API。
Undertow 具有基于组合的架构,允许您通过组合小型单一用途处理程序来构建 Web 服务器。这使您可以灵活地在完整的 Java EE servlet 3.1 容器或低级非阻塞处理程序之间进行选择。
Undertow 非常轻巧,Undertow 核心 jar 的大小不到 1Mb。它在运行时也是轻量级的,一个简单的嵌入式服务器使用不到 4Mb 的堆空间。
Link to official site.
链接到官方网站。
回答by Harald
Since you tagged this as Jersey, I'll mention that the Jersey docs show examples of how to deploy using the HTTP server that is built-in to the Java runtime:
由于您将其标记为 Jersey,我将提到 Jersey 文档显示了如何使用 Java 运行时内置的 HTTP 服务器进行部署的示例:
https://jersey.java.net/documentation/latest/deployment.html#deployment.http
https://jersey.java.net/documentation/latest/deployment.html#deployment.http
回答by Victor Sergienko
Going through Pipposystem requirements, I found TJWS - Tiny Java Web Server and Servlet Container, BSD license.
通过Pippo系统要求,我找到了TJWS - Tiny Java Web Server 和 Servlet 容器,BSD 许可。