I'm having an issue loading the Swagger UI / enabling the UI endpoint. Maven project, Jersey version - 2.12, Swagger version - 1.5.1-M2
I've a programmatically configured jersey web app. In my (extension of) ResourceConfig, I set the following for Swagger:
beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setHost("http:localhost:8080");
beanConfig.setBasePath("/app/v1");
beanConfig.setResourcePackage("com.app.features");
beanConfig.setScan(true);
register(beanConfig);
register(new ApiListingResourceJSON());
register(new SwaggerSerializers());
I also have a bootscrap class, which I load via web.xml :
public class Bootstrap extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
Info info = new Info()
.title("Swagger Sample App")
.description("Desc")
.termsOfService("http://helloreverb.com/terms/")
.contact(new Contact()
.email("[email protected]"))
.license(new License()
.name("Apache 2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.html"));
ServletContext context = config.getServletContext();
Swagger swagger = new Swagger().info(info);
context.setAttribute("swagger", swagger);
}
}
Said web.xml:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Bootstrap</servlet-name>
<servlet-class>com.app.Bootstrap</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
I have copied the contents of the Swagger UI dist to my web app folder.
When I hit the api json endpoints on http://localhost:8080/app/v1/swagger.json I do get the json code, e.g. :
{"swagger":"2.0","info":{"version":"1.0.0"},"host":"http:localhost:8080","basePath":"/app/v1"}
but I don't seem to see the Swagger UI on the paths I would expect (http:localhost:8080/app/v1 or http:localhost:8080/app/v1/app/v1/index.html).
I'm unfortunately not as comfortable with Jersey as I am with Spring, so any assistance would be welcome.
Thanks