可以将任意文件的内容流式传输到浏览器的 Java Web 应用程序(live tail)
我在网上搜索了一段时间的 Java Web 应用程序,该应用程序可用于“跟踪”文件系统上的任何任意文件。最重要的要求是让应用程序流回文件更改,这样我就不必刷新(就像您可以使用 node.js 轻松完成的操作一样)。
我自己可以快速编写一个,但流媒体要求并非微不足道。此外,该应用程序应该可以部署在 Java 应用程序服务器中。
有什么指针吗?
谢谢
I have been searching the web for a while for a Java web application that can be used to "tail" on any arbitrary file on the file system. The most important requirement would be to have the app to stream back the file changes so that I don't have to refresh (like the stuff you can easily do with node.js).
I can quickly write one myself but the streaming requirement is not trivial. Also, the app should be deployable in a Java app server.
Any pointer?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,所以我遵循了 @Liv 的建议,我自己构建了这个东西。
这是几个小时编码的成果,所以不要期望太多。
我已经在Tomcat和Jetty上测试过了。查看自述文件。
https://github.com/aestasit/logviewer
Ok, so I followed @Liv suggestion and I have built the thing myself.
It's the fruit of a couple of hours of coding, so don't expect much.
I have tested it on Tomcat and Jetty. Check out the README file.
https://github.com/aestasit/logviewer
不久前我不得不自己做这件事,因为我找不到。我建议通过 Ajax 路线进行下去——因为尝试启动“tail -f ...”进程并捕获其控制台是乏味的,而且由于您长时间保持与浏览器的连接打开,您会发现有时浏览器会关闭连接。
I had to do this myself a while back as I couldn't find one. I would recommend going down via the Ajax route -- as trying to have "tail -f ..." process started and capturing its console is tedious and also since you keep the connection to the browser open for a long while you will find out that sometimes the browser will just close the connection.