简体   繁体   English

现有Java应用程序的Web服务器

[英]Web Server for existing Java application

I have an existing Java application running on a linux box that monitors the state of relays and network information. 我有一个运行在linux机器上的现有Java应用程序,用于监视中继和网络信息的状态。 This is a stand-alone device currently. 这是当前的独立设备。

What I would like to further develop is a web server for the device to remotely monitor, configure, and control the device via an Ethernet connection. 我想进一步开发的是一个Web服务器,用于设备通过以太网连接远程监视,配置和控制设备。 To achieve this, I need some way to interface between the web server, which could be configured as enabled/disabled, and the master device, which is always running. 为实现此目的,我需要某种方式在可配置为启用/禁用的Web服务器和始终运行的主设备之间建立接口。

Is there a good way to do this? 有什么好方法吗? I have looked at apache w/ tomcat and similar web servers but not sure if this is what I need. 我看过apache w / tomcat和类似的Web服务器,但不确定这是否是我需要的。 The key here is that the web server needs to be able to access the existing java application without interfering with its always running services. 这里的关键是Web服务器需要能够访问现有的Java应用程序而不会干扰其始终运行的服务。

You either develop a webapp, use your Java application's API inside the webapp, and deploy this webapp inside a web container. 您可以开发一个Web应用程序,在该Web应用程序中使用Java应用程序的API,然后将该Web应用程序部署在Web容器中。 Or you can do the reverse and embed a web server inside your application (see here for documentation to embed Jetty). 或者,您也可以反向进行操作,然后将Web服务器嵌入到应用程序中(有关嵌入Jetty的文档 ,请参见此处)。

If you want to keep the webapp and the original application in two separate JVMs, you'll need some wey to communicate between both, like sockets, RMI, or even files, but it will be more complex. 如果要将webapp和原始应用程序保留在两个单独的JVM中,则需要一些麻烦才能在两者之间进行通信,例如套接字,RMI甚至文件,但这会更加复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM