嵌入式码头与其父应用程序之间的通信

发布于 2024-08-18 17:45:31 字数 118 浏览 2 评论 0原文

我有 Windows 服务应用程序,我想为我的应用程序使用 Web 界面而不是 gui。但我想知道如何使 jetty 中的 servlet 与其托管应用程序(Windows 服务应用程序)进行通信。

谢谢。

i have windows service app and i want to use web interface for my app instead of gui. But i wonder how to make a servlet in jetty communicate with its hosted application - the windows service app.

Thank you.

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

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

发布评论

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

评论(2

飘逸的'云 2024-08-25 17:45:31

由于您要从 JVM(码头)内部到 JVM(您的服务)外部,因此您可能必须使用套接字,除非您想深入研究 JNI(Java 本机接口),但这可能比您想要的更多工作。

我假设您的 Windows 服务是一个实际的本机 Windows 应用程序,而不是带有服务包装器的 Java 应用程序。

祝你好运。

Since you are going from inside a JVM (jetty) to outside the JVM (your service), you will probably have to use sockets, unless you want to delve into JNI (java native interface), but that's probably more work than you want.

I am assuming that your windows service is an actual native windows app and not a Java app with a service wrapper around it.

Good luck.

擦肩而过的背影 2024-08-25 17:45:31

您可以使用相同的类加载器通过以下方式解决问题:

WebAppContext webapp = new WebAppContext(jetty_home + "/JavaServices", "/JavaServices");
webapp.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());//THIS LINE IS THE KEY

You can use the same classloader to solve the problem by:

WebAppContext webapp = new WebAppContext(jetty_home + "/JavaServices", "/JavaServices");
webapp.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
webapp.setClassLoader(Thread.currentThread().getContextClassLoader());//THIS LINE IS THE KEY
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文