简体   繁体   English

在Java中设置Web服务器的最简单方法是什么?

[英]What's the simplest way to setup a web server in java?

I have server daemons running on several machines. 我有在几台计算机上运行的服务器守护程序。 I decide to expose the internal stats of the server daemons for monitoring and statistic, using HTTP protocol. 我决定使用HTTP协议公开服务器守护程序的内部统计信息,以进行监视和统计。

So, what's the simplest way to do this? 那么,最简​​单的方法是什么?

  • The less 3rd-party jar dependencies, the better. 第三方jar依赖关系越少越好。
  • The lighter the framework is, the better. 框架越轻越好。
  • The less complexity, the better. 复杂度越低越好。

If the stats are a small number of fairly basic statistics, and you aren't wedded to the HTTP server concept, use JMX. 如果这些统计信息是相当基本的统计信息的一小部分,并且您不熟悉HTTP服务器的概念,请使用JMX。 I used it to instrument a daemon process and it was pretty simple. 我用它来检测守护进程,这非常简单。 You can monitor remotely (on another computer) via an ugly, but serviceable UI. 您可以通过丑陋但可维护的UI远程(在另一台计算机上)监视。

Here's a tutorial instrumenting a web server app Probably very close to what you want. 这是指导Web服务器应用程序的教程,可能非常接近您想要的内容。

Here's a StackOverflow link on remote monitoring 这是有关远程监控的StackOverflow链接

The lightest weight java webserver I know of is Jetty . 我所知道的最轻量的Java Web服务器是Jetty If you use maven, you don't have to add any dependencies to your project, just add jetty as a plugin: 如果使用maven,则不必向项目添加任何依赖项,只需将jetty添加为插件:

 <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.26</version>
 </plugin>

then you can just call 那你就可以打电话

 mvn jetty:run

at the command line. 在命令行中。 a lot of open source projects ship with a jetty server embedded, including hadoop. 许多开放源代码项目都附带嵌入式码头服务器,包括hadoop。

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

相关问题 打印 Java 数组的最简单方法是什么? - What's the simplest way to print a Java array? 在Java应用程序中响应AJAX请求的最简单方法是什么? - What's the simplest way to respond to AJAX requests within a Java application? 将数据从 java 程序存储到 MySQL 的最简单方法是什么? - What's the simplest way to store data from a java program to MySQL? 为java程序制作本地遥控器的最简单方法是什么? - What's the simplest way to make a local remote for a java program? 在 Java 中绘制最简单的方法是什么? - What is the simplest way to draw in Java? 在Java Web应用程序中从应用程序服务器外部提供静态数据的最简单方法BUT In WEB LOGIC - Simplest way to serve static data from outside the application server in a Java web application BUT In WEB LOGIC 使用 Java 从 Amazon S3 获取链接的最简单方法是什么? - What's the simplest way to get links from Amazon S3 using Java? 用Java编写文本文件的最简单方法是什么? - What is the simplest way to write a text file in Java? Java客户端服务器文件同步 - 最简单的方法 - Java Client Server File Synchronization - Simplest way 在Java中执行设置文件的最简单方法是什么? - What is the simplest way to do settings files in Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM