package com.mangofactory.swagger.paths;

import javax.servlet.ServletContext;

public class  RelativeSwaggerPathProvider extends SwaggerPathProvider {
    public static final String ROOT = "/";
  private final ServletContext servletContext;

  public RelativeSwaggerPathProvider(ServletContext servletContext) {
    super();
    this.servletContext = servletContext;
  }

  @Override
    protected String applicationPath() {
        return servletContext.getContextPath();
    }

    @Override
    protected String getDocumentationPath() {
        return ROOT;
    }
}

package com.mangofactory.swagger.paths;

import javax.servlet.ServletContext;

import static com.google.common.base.Strings.isNullOrEmpty;

public class  RelativeSwaggerPathProvider extends SwaggerPathProvider {
    public static final String ROOT = "/";
  private final ServletContext servletContext;

  public RelativeSwaggerPathProvider(ServletContext servletContext) {
    super();
    this.servletContext = servletContext;
  }

  @Override
    protected String applicationPath() {
        return isNullOrEmpty(servletContext.getContextPath()) ? ROOT : servletContext.getContextPath();
    }

    @Override
    protected String getDocumentationPath() {
        return ROOT;
    }
}

Fix for when the context path is at the root the 'try this' doesnt work
Fix for when the context path is at the root the 'try this' doesnt work
