Admin Console

Togglz comes with an embedded admin console that allows you to enable or disable features and edit the user list associated with every feature. The following screenshot shows the main page of the console.

To enable the Togglz admin console, add the following dependency to your pom.xml:

<!-- Togglz Admin Console -->
<dependency>
  <groupId>org.togglz</groupId>
  <artifactId>togglz-console</artifactId>
  <version>2.3.0.Final</version>
</dependency>

If you deploy your application to a Servlet 3.0 container, you won't have to do any further configuration. If your container doesn't support Servlet 3.0, you will have to add the TogglzConsoleServlet to your /WEB-INF/web.xml like this:

<servlet>
  <servlet-name>TogglzConsoleServlet</servlet-name>
  <servlet-class>org.togglz.console.TogglzConsoleServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>TogglzConsoleServlet</servlet-name>
  <url-pattern>/togglz/*</url-pattern>
</servlet-mapping>

The admin console will be available in a virtual path named togglz within you application. So if you application is deployed to a context path named myapp within the container, you will have to use the following URL:

http://localhost:8080/myapp/togglz/

Please note that you will have to configure the user authentication as described in the Configuration and Authentication chapters to be able to access the admin console.

If you just want to give it a try and don't want to walk thought the complete configuration of the user authentication, you can simply configure a dummy UserProvider that assigns administration privileges to every user:

public class MyTogglzConfiguration implements TogglzConfig {

    /* ..... */

    @Override
    public UserProvider getUserProvider() {
        return new UserProvider() {
            @Override
            public FeatureUser getCurrentUser() {
                return new SimpleFeatureUser("admin", true);
            }
        };
    }
}

Please don't use this in production environments. :)