如何为 Java 应用程序提供 HTTP 管理控制台?

发布于 2024-09-10 02:51:30 字数 342 浏览 3 评论 0原文

我正在编写一个 Java 应用程序,该应用程序将运行很长时间(本质上,它在系统重新启动之间保持运行),并执行大量密集的近实时数据处理。数据被传递到应用程序,对该数据完成一些工作,然后将其传递以进行传递。

我需要提供一种在运行时检查应用程序内部运作的方法。我已经有了一个相当完善但手工制作的 telnet 风格界面,允许您使用命令行来询问有关统计、数据队列等的问题,但我想将其转移到 HTTP,因为我认为它会请允许我提供更丰富的情况图片(显示负载图等)。

是否有任何已建立的 Java 框架允许我嵌入 Web 服务器并以合理的方式处理请求?我真的不想手工制作大量的 HTML 处理和响应生成,因为这只是烦人的背景噪音,不利于我所需要的本质。

I'm writing a Java application that will run for a long time (essentially, it stays running between system restarts) and does a fair bit of intensive near real-time data processing. Data is delivered to the application, some work is done on that data, and it's then passed on for delivery.

I need to provide a way to inspect the inner workings of the application at runtime. I've already got a fairly well established but hand-carved telnet style interface that allows you to use a command line to ask questions about statistics, data queues, etc, but I'd like to move that to HTTP as I think it will allow me to provide a much richer picture of what's going on (showing load graphs, etc).

Are there any established Java frameworks that allow me to embed a web server and handle requests in a reasonable way? I don't really want to have to hand-carve a whole lot of HTML handling and response generation as it's just annoying background noise to the essence of what I need.

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

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

发布评论

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

评论(2

指尖上得阳光 2024-09-17 02:51:30

您确定要嵌入 HTTP 接口吗?

执行此类操作的一种非常常见的方法是使用受限制的 RMI 接口设置 Java 应用程序。然后,您编写一个 J2EE (JSP/Servlet) Web 界面,该界面对应用程序进行 RMI 调用以获取数据。

这种设置避免了您必须实现 HTTP 协议(​​或任何其他接口协议 - RMI 调用只是 Java 方法),并且还将数据(嵌入式 J2SE 程序)与表示(用户界面 J2EE 程序)分开。

Are you sure you want to embed an HTTP interface?

A pretty common way of doing things like this is to set the Java application up with a restricted RMI interface. Then, you write a J2EE (JSP/Servlet) web interface which makes RMI calls to the application for data.

This setup avoids you having to implement the HTTP protocol (or any other interface protocol - RMI calls are just Java methods), and also separates data (the embedded J2SE program) from presentation (the user-interface J2EE program).

你的往事 2024-09-17 02:51:30

您可能需要考虑使用 jconsole 和 JMX (http://java.sun. com/developer/technicalArticles/J2SE/jconsole.html)。

它们提供了一种图形方式来查看应用程序内部发生的情况,您还可以设置控件以通过 jconsole 执行给定的操作。

You may want to consider using jconsole and JMX (http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html).

They provide a graphical way to see what is going on inside your application and you can also setup controls to perform given actions through jconsole.

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