The Apache Software Foundation

Configure Custom WebAdmin routes

The current project demonstrates how to write custom webadmin routes for Apache James. This enables writing new administrative features exposed over a REST API. This can allow you to write some additional features, make James interact with third party systems, do advance reporting...

Find this example on GitHub.

Start by importing the dependencies:


You can then write your first route using the Spark Java framework:

public class RouteA implements Routes {
    public String getBasePath() {
        return "/hello/a";

    public void define(Service service) {
        service.get(getBasePath(), (req, res) -> "RouteA\n");
    Knowing that:
  • entending Routes: will ensure that authentication is requested if configured.
  • entending PublicRoutes: will not request authentication.

You can compile this example project:

mvn clean install

Then embed your route into a James server. First configure your route into


# List of fully qualified class names that should be exposed over webadmin
# in addition to your product default routes. Routes needs to be located
# within the classpath or in the ./extensions-jars folder.

Create a keystore (default password being james72laBalle):

keytool -genkey -alias james -keyalg RSA -keystore keystore

Then start a James server with your JAR and the configuration:

docker run -d \
   -v $PWD/ \
   -v $PWD/exts:/root/extensions-jars \
   -v $PWD/keystore:/root/conf/keystore \
   -p 25:25 \

You can play with curl utility with the resulting server:

$ curl -XGET