Have a web application running in tomcat in a war file and as part of it I have jax-rs rest apis implemented with jax-rs and bound by jersey. These rest apis have some swagger annotations, however I cannot seem to get the swagger-ui to function properly.
Strucure
warFile
+docs
----swagger is here
+web-inf
++web.xml
++lib
----all my jax-rs jars here
+meta-inf
----nothing
The jersey config I have defined
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() throws Exception {
packages("com.myapp.somefiles");
BeanConfig config = new BeanConfig();
config.setBasePath("rest");
config.setResourcePackage("com.myapp.somefiles");
config.setScan(true);
}
Web.xml
<servlet>
<servlet-name>com.myapp.somefile.JerseyConfig</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>com.myapp.somefile.JerseyConfig</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
So when I have the swagger-ui html files in the war file I can access them with; localhost:8181/warFile/docs. However I would like to have this loaded on the same URL as my rest api which could be localhost:8181/warFile/rest/docs
I can access the swagger.json file at localhost:8181/warFile/rest/swagger.json
Do I need to load swagger with a classloader in the context of my servlet or beanconfig? The swagger-ui can also be packaged with one of the jar dependencies found in the /lib directory. Can I reference this somehow?