I need to build a Java app to run like a daemon on UNIX (FreeBSD). The app would need to start up just like any UNIX process. After starting, it sits there and wait for commands from the master host/server. Commands are fed to this app via RESTful web services calls – so it needs to listen for network connections at a particular port. At the same time, it needs to access resouces at external hosts/websites by making outgoing http calls.
What is the best approach for writing such app? I am thinking of writing a standalone app and include Grizzly and Jersey libraries. Is this the right approach? Is there a better approach?
(Also, I don’t think I should write a normal web application – war file – to be deployed in GlassFish or some sort of Java container.)
There is no single best approach.
It will work, assuming that you follow the relevant documentation.
Possibly.
That is another approach.
Another would be to use a light-weight container like Jetty.