Reputation: 19733
I'm new to server-side development and have been experimenting with the Play framework recently. And I'm curious to know if there is an equivalent of ServletContextListener in Play. I found an Application class and a Plugin class from the Javadocs.
I want to start a bluetooth server from my web application when it starts and want to shut it down when the web app quits.
Many thanks in advance.
Upvotes: 1
Views: 574
Reputation: 21564
Take a look at the Global object: start your bluetooth server to the onStart()
method, and stop it in the onStop()
method.
public class Global extends GlobalSettings {
@Override
public void onStart(Application app) {
Logger.info("Application has started");
}
@Override
public void onStop(Application app) {
Logger.info("Application shutdown...");
}
}
This Global
class must be located in the root of your app
folder.
Upvotes: 3