Skip to content

Instantly share code, notes, and snippets.

@jonocodes
Created October 26, 2015 19:02
Show Gist options
  • Save jonocodes/e95999d34a643ef05519 to your computer and use it in GitHub Desktop.
Save jonocodes/e95999d34a643ef05519 to your computer and use it in GitHub Desktop.
import io.swagger.models.Info;
import io.swagger.models.Swagger;
import io.swagger.models.auth.BasicAuthDefinition;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
public class JerseySwaggerConfig extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
Info info = new Info()
.title("Named Entity Database API");
ServletContext context = config.getServletContext();
Swagger swagger = new Swagger().info(info);
swagger.securityDefinition("basic", new BasicAuthDefinition());
swagger.setBasePath("/vx");
context.setAttribute("swagger", swagger);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment