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;
    }
}

@@ -72,16 +72,77 @@
 ntext;%0A%0A
+import static com.google.common.base.Strings.isNullOrEmpty;%0A%0A
 public c
@@ -493,16 +493,72 @@
   return
+ isNullOrEmpty(servletContext.getContextPath()) ? ROOT :
  servlet

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