Jetty:嵌入还是不嵌入?
嵌入 jetty 与 在 jetty 中部署你的 web 应用程序?如果您计划部署多个 Web 应用程序,是否应该严格坚持为每个 Web 应用程序部署一个 war 文件(而不是编写一个调用每个 Web 应用程序的嵌入式服务器)?
What are the benefits of embedding jetty vs deploying your webapp(s) in jetty? If you are planning on deploying more than one web app, should you strictly stick with deploying a war file for each web app (as opposed to writing an embedded server which calls each web app)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当目标是创建一个独立的应用程序时,我会使用嵌入的jetty,其中jetty只是其中的组件之一(例如在osgi容器中)。如果您只想部署一些战争,那么默认的码头安装似乎更可取。
我认为这一选择并不取决于您是否计划部署多个网络应用程序。当您嵌入码头时,您必须在代码中自行填充。
i'd use jetty embedded when the goal is to create a standalone application in which jetty is just one of the components (for example in an osgi container). if you just want to deploy some war's then a default jetty installation seems more preferable.
i don't think the choice depends on whether you plan to deploy more than one webapp. when you embed jetty you'll have to do the plumping yourselves in your code.
嵌入 jetty 在我熟悉的两种情况下很方便:
JNI。确保您在正确的类加载器中拥有正确的内容要容易得多。
发展。在 Eclipse 中启动嵌入式码头比使用 Eclipse Web 工具并处理部署和调试器附加要容易得多。
Embedding jetty is handy in two cases I'm familiar with:
JNI. It's a lot easier to make sure you've got the right things in the right class loader.
Development. It's much easier to fire up an embedded jetty in eclipse than to dance around with the eclipse web tools and deal with deployments and debugger attaching.
查看 Winstone servlet 容器,它允许您将单个 WAR 文件作为可执行 jar 分发作为支持的用途案件。这就是哈德森所做的。
Have a look at the Winstone servlet container which allows you to distribute a single WAR file as an executable jar as a supported use case. This is what Hudson does.