Java web application that can stream the content of an arbitrary file to the browser (live tail)
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?
T开发者_如何学Gohanks
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
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.
精彩评论