Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.


Repository files navigation

Circle CI Download

Dropwizard Index Page

A bundle that serves the index page for a single page application. It covers the following areas:

  • Serves the index page for a list of url patterns specified during the bundle creation.
  • Templates the index page with the correct base tag value, the context path of your application.
  • Add disable caching header when serving the index page.
    • cache-control: no-cache, no-store, max-age=0, must-revalidate


  1. Add the com.palantir.indexpage:dropwizard-index-page:<VERSION> dependency to your project's build.gradle file. The most recent version number can be found by looking at the Releases Page. The dependencies section should look something like this:

    dependencies {
        // ... unrelated dependencies omitted ...
        compile "com.palantir.indexpage:dropwizard-index-page:<VERSION>"
  2. Ensure the base tag in your index.html page is set using mustache:

    <base href="{{baseUrl}}">
  3. Have your configuration implement IndexPageConfigurable:

    public final class ExampleApplicationConfiguration extends Configuration implements IndexPageConfigurable {
        private final String indexPagePath;
        ExampleConfig(@JsonProperty("indexPagePath") Optional<String> indexPagePath) {
            this.indexPagePath = indexPagePath.or("service/web/index.html");
        public String getIndexPagePath() {
            return this.indexPagePath;
  4. Add the bundle to your application:

    public final class ExampleApplication extends Application<ExampleConfiguration> {
        public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
            bootstrap.addBundle(new IndexPageBundle(ImmutableSet.of("/views/*"));`


The default index page path is service/web/index.html and you can override the path via the IndexPageConfigurable interface.

NOTE: The path for the index page can be either the file sytem path or the classpath and the file system path takes precedence over the classpath if the file exists in both paths.

Setting up the project with an IDE

with Eclipse, import the project and run:

    ./gradlew eclipse

with IntelliJ, import the project and run:

    ./gradlew idea


Before working on the code, if you plan to contribute changes, please read the CONTRIBUTING document.


This project is made available under the Apache 2.0 License.