使用 jetty 将 Web 应用程序嵌入到桌面应用程序中

发布于 2025-01-05 00:54:38 字数 126 浏览 3 评论 0原文

我有一个在tomcat下运行的war文件,我需要将其作为桌面应用程序,大多数人建议嵌入jetty服务器作为桌面应用程序,任何人都可以通过示例解释如何做到这一点。我有点困惑如何做到这一点或一些将 jetty 服务器嵌入为桌面应用程序的教程。

I have an war file with runs under tomcat i need to make it as an desktop application and most of them recommend to embedded an jetty server as an desktop application can any one explain how to do it with an example. I am little confused how to do it or some tutorials that embedded jetty server as desktop application.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南风起 2025-01-12 00:54:38

您可以选择以下选项:

These are your options:

夜雨飘雪 2025-01-12 00:54:38

如果你敢尝试的话,嵌入 Jetty 真的很简单。乍一看,Web 服务器是神秘的野兽,但它们实际上只是打开服务器套接字并侦听 HTTP 请求的“简单”Java 应用程序。 只需创建一个 Serverstart() 实例

这将创建几个新线程,Jetty 将在其中处理请求。你的主线程可以自由地做它想做的任何事情。要停止它,请调用 stop()join()

Embedding Jetty is really simple if you dare to try it. At first glance, web servers are mysterious beasts but they are really just "simple" Java applications which open a server socket and listen to HTTP requests. Just create an instance of Server and start() it.

That will create a couple of new threads in which Jetty will handle requests. Your main thread is free to whatever else it wants to do. To stop it, call stop() and join().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文