#Server Notifier
A collection of desktop notifications for your webapp containers (Tomcat, Jetty) to indicate when it has started or stopped.
Configuration
Notifications are based on send-notification, you should visit its wiki to find which notifier you want to use and how to configure it.
By default it will try to use Growl
for Windows, OSX and notify-send
for Linux
.
Tomcat 7/8
Installation
-
Get tomcat-notifier and copy it in
$CATALINA_HOME/lib
-
Configure a new listener in
$CATALINA_HOME/conf/Catalina/[host]/[application].xml
(iecontext.xml
) or in$CATALINA_HOME/conf/server.xml
depending if you want a notification for just a webapp or for the server globally<Listener className="fr.jcgay.servernotifier.tomcat.TomcatNotifierListener" />
-
Choose a
SLF4J
binding to configure logging and copy it in$CATALINA_HOME/lib
(you can take slf4j-simple)
You can find example of context.xml
or server.xml
in example-webapp.
Usage with Maven plugin
Add plugin in pom.xml
:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<contextFile>src/tomcat/context.xml</contextFile>
</configuration>
<dependencies>
<dependency>
<groupId>fr.jcgay.server-notifier</groupId>
<artifactId>tomcat-notifier</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.12</version>
</dependency>
</dependencies>
</plugin>
with context.xml
minimal configuration:
<?xml version='1.0' encoding='utf-8'?>
<Context>
<Listener className="fr.jcgay.servernotifier.tomcat.TomcatNotifierListener" />
</Context>
Jetty 7/8/9
Installation
-
Get jetty-notifier and copty it in
$JETTY_HOME/lib/ext
-
Configure a new listener in
$JETTY_HOME/etc/jetty.xml
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <Call name="addLifeCycleListener"> <Arg> <New class="fr.jcgay.servernotifier.jetty.JettyNotifierListener"/> </Arg> </Call> </Configure>
-
Choose a
SLF4J
binding to configure logging and copy it in$CATALINA_HOME/lib
(you can take slf4j-simple)
You can find example of jetty.xml
in example-webapp
Usage with Maven plugin
Add plugin in pom.xml
:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.6.16.v20140903</version>
<configuration>
<jettyXml>src/jetty/jetty.xml</jettyXml>
</configuration>
<dependencies>
<dependency>
<groupId>fr.jcgay.server-notifier</groupId>
<artifactId>jetty-notifier</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.12</version>
</dependency>
</dependencies>
</plugin>
with jetty.xml
minimal configuration:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addLifeCycleListener">
<Arg>
<New class="fr.jcgay.servernotifier.jetty.JettyNotifierListener"/>
</Arg>
</Call>
</Configure>