package org.rnorth.dropwizard.markdown.demo;

import io.dropwizard.Application;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.rnorth.dropwizard.markdown.MarkdownAssetsBundle;
import org.rnorth.dropwizard.markdown.MarkdownAssetsConfiguration;
import org.rnorth.dropwizard.markdown.MarkdownBundleConfiguration;

/**
 * Created by rnorth on 29/09/2016.
 */
public class DemoApplication extends Application<DemoApplication.DemoConfiguration> {

    @Override
    public void initialize(Bootstrap<DemoConfiguration> bootstrap) {
        bootstrap.addBundle(new MarkdownAssetsBundle()
                .withResourcePath("/docs")
                .withUriPath("/docs"));
    }

    @Override
    public void run(DemoConfiguration configuration, Environment environment) throws Exception {
        // Nothing needed here for demo purposes
    }

    public static void main(String[] args) throws Exception {
        new DemoApplication().run(args);
    }

    public static class DemoConfiguration extends Configuration implements MarkdownBundleConfiguration {

        public MarkdownAssetsConfiguration assets = new MarkdownAssetsConfiguration();

        @Override
        public MarkdownAssetsConfiguration getMarkdownAssetsConfiguration() {
            return assets;
        }
    }
}




@@ -382,16 +382,136 @@
 ation;%0A%0A
+import javax.ws.rs.GET;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.core.Response;%0Aimport javax.ws.rs.core.UriBuilder;%0A%0A
 /**%0A * C
@@ -546,16 +546,27 @@
 16.%0A */%0A
+@Path(%22/%22)%0A
 public c
@@ -1031,16 +1031,99 @@
 purposes
+, but redirect the root path to /docs/%0A        environment.jersey().register(this);
 %0A    %7D%0A%0A
@@ -1549,16 +1549,16 @@
 assets;%0A
-
         
@@ -1564,14 +1564,163 @@
  %7D%0A    %7D
+%0A%0A    @GET%0A    public Response redirectRootToDocs() %7B%0A        return Response.temporaryRedirect(UriBuilder.fromPath(%22/docs/%22).build()).build();%0A    %7D
 %0A%7D%0A%0A%0A%0A

Add redirect from / to /docs/ for demo purposes